Golang go/build.Context.MatchFile() function example

package go/build

MatchFile reports whether the file with the given name in the given directory matches the context and would be included in a Package created by ImportDir of that directory.

MatchFile considers the name of the file and may use ctxt.OpenFile to read some or all of the file's content.

Golang go/build.Context.MatchFile() function usage example

 var ctxt  Context
 var somename string
 ...
 match, err := ctxt.MatchFile("x", somename)
 if err != nil {
 fmt.Println(err)
 }

Reference :

http://golang.org/pkg/go/build/#Context.MatchFile

Advertisement