Skip to content

Instantly share code, notes, and snippets.

@apahl
Last active September 21, 2018 16:02
Show Gist options
  • Save apahl/631d13002e633372cffb3fbf48cd8385 to your computer and use it in GitHub Desktop.
Save apahl/631d13002e633372cffb3fbf48cd8385 to your computer and use it in GitHub Desktop.
go module question
Module structure:
~/dev/go/collect
$ tree
.
├── go.mod
├── go.sum
├── LICENSE.txt
├── maps
│   ├── maps_gen.go
│   ├── maps.go
│   └── maps_test.go
├── README.md
├── sets
│   ├── sets.go
│   └── sets_test.go
└── slices
├── slices_gen.go
├── slices.go
├── slices_int.go
└── slices_test.go
content of go.mod:
module github.com/apahl/collect
require (
github.com/cheekybits/genny v1.0.0
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b // indirect
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f // indirect
golang.org/x/sys v0.0.0-20180920110915-d641721ec2de // indirect
golang.org/x/text v0.3.0 // indirect
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e // indirect
)
The problem is: even after issuing `go install ...`, I can not import any of the packages from this module.
E.g. `import "github.com/apahl/collect/sets"` in another project fails.
What am I doing wrong here? Do I need to put go.mod files in all the sub-package dirs (maps, sets, slices) as well?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment