1*9bb1b549SSpandan Das// Copyright 2020 Google LLC 2*9bb1b549SSpandan Das// 3*9bb1b549SSpandan Das// Licensed under the Apache License, Version 2.0 (the "License"); 4*9bb1b549SSpandan Das// you may not use this file except in compliance with the License. 5*9bb1b549SSpandan Das// You may obtain a copy of the License at 6*9bb1b549SSpandan Das// 7*9bb1b549SSpandan Das// https://www.apache.org/licenses/LICENSE-2.0 8*9bb1b549SSpandan Das// 9*9bb1b549SSpandan Das// Unless required by applicable law or agreed to in writing, software 10*9bb1b549SSpandan Das// distributed under the License is distributed on an "AS IS" BASIS, 11*9bb1b549SSpandan Das// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*9bb1b549SSpandan Das// See the License for the specific language governing permissions and 13*9bb1b549SSpandan Das// limitations under the License. 14*9bb1b549SSpandan Das 15*9bb1b549SSpandan Daspackage main 16*9bb1b549SSpandan Das 17*9bb1b549SSpandan Dasimport ( 18*9bb1b549SSpandan Das "fmt" 19*9bb1b549SSpandan Das "io/ioutil" 20*9bb1b549SSpandan Das 21*9bb1b549SSpandan Das "github.com/bazelbuild/rules_go/go/runfiles" 22*9bb1b549SSpandan Das) 23*9bb1b549SSpandan Das 24*9bb1b549SSpandan Dasfunc main() { 25*9bb1b549SSpandan Das path, err := runfiles.Rlocation("io_bazel_rules_go/tests/runfiles/test.txt") 26*9bb1b549SSpandan Das if err != nil { 27*9bb1b549SSpandan Das panic(err) 28*9bb1b549SSpandan Das } 29*9bb1b549SSpandan Das b, err := ioutil.ReadFile(path) 30*9bb1b549SSpandan Das if err != nil { 31*9bb1b549SSpandan Das panic(err) 32*9bb1b549SSpandan Das } 33*9bb1b549SSpandan Das fmt.Println(string(b)) 34*9bb1b549SSpandan Das} 35