Golang go/token.NewFileSet function example

package go/token

NewFileSet creates a new file set.

Golang go/token.NewFileSet function usage example

 var path string
 fset := token.NewFileSet()
 pkg, err := parser.ParseFile(fset, path, nil, 0)
 if err != nil {
 fmt.Println(err)
 os.Exit(1)
 }

Reference :

http://golang.org/pkg/go/token/#NewFileSet

Advertisement