The discrepancy between the package name and the suggested import statement is potentially confusing and problematic.
The suggested import path is "github.com/temoto/robotstxt.go", which implies that the go get call should be for the same path.
This becomes a bit of a problem when testing packages individually because go test robotstxt.go will think we're referencing a file when we're really referencing a directory. Workarounds include using a get and import path that reflect the real package name i.e. keep the dash or to append a slash to the test command i.e. go test robotstxt.go/
Is there a particular reason you chose to suggest importing the package as "robotstxt.go" instead of "robotstxt-go"?
Ultimately, I would suggest getting rid of the dash (and any reference to "go") from the package name altogether to avoid issues like this. That appears to be the more idiomatic approach to naming packages.
The discrepancy between the package name and the suggested import statement is potentially confusing and problematic.
The suggested import path is "github.com/temoto/robotstxt.go", which implies that the
go get
call should be for the same path.This becomes a bit of a problem when testing packages individually because
go test robotstxt.go
will think we're referencing a file when we're really referencing a directory. Workarounds include using a get and import path that reflect the real package name i.e. keep the dash or to append a slash to the test command i.e.go test robotstxt.go/
Is there a particular reason you chose to suggest importing the package as "robotstxt.go" instead of "robotstxt-go"?
Ultimately, I would suggest getting rid of the dash (and any reference to "go") from the package name altogether to avoid issues like this. That appears to be the more idiomatic approach to naming packages.