Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do we need to import anything? #3

Closed
GoogleCodeExporter opened this issue Feb 2, 2016 · 2 comments
Closed

do we need to import anything? #3

GoogleCodeExporter opened this issue Feb 2, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

trying out one example, below are my files at a particular location

#config.gcfg
[production]
db-host = 127.0.0.1
db-password = hahahah

#main.go
package main

import "fmt"
import "gcfg"

func main() {
  var cfg Config
  err := gcfg.ReadFileInto(&cfg, "config.gcfg")
  fmt.Println(cfg)
}

# and the output with `import "gcfg"` is
main.go:4:8: import "gcfg": cannot find package

# and the output without `import "gcfg"` is
# command-line-arguments
./main.go:6: undefined: Config
./main.go:7: undefined: gcfg


Original issue reported on code.google.com by amolpuj...@gmail.com on 27 Mar 2013 at 1:47

@GoogleCodeExporter
Copy link
Author

ohh, got it.

Original comment by amolpuj...@gmail.com on 27 Mar 2013 at 1:59

@GoogleCodeExporter
Copy link
Author

Thanks for trying my package.

It seems that you have figured it out but I'll post it here for reference:
http://golang.org/cmd/go/#hdr-Remote_import_path_syntax
I omitted the import from the example on the project page as it is standard Go 
convention.

For more real-world examples, you can search for programs using 
"code.google.com/p/gcfg" on code sharing sites (e.g. github.com), here is one 
example:
https://github.com/abh/geodns/blob/ab821f706123806ac910132b96170dd1bdbd138a/conf
ig.go

Original comment by speter....@gmail.com on 27 Mar 2013 at 11:41

  • Changed state: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant