To get started, create a new directory and initialize your module with go mod init
:
$ mkdir gorepo && cd gorepo
$ go mod init git.fury.io/example/gorepo
This command will create an initial go.mod
file to describe your project. The file will contain the project’s name and other module dependencies. Be sure to commit go.mod
and the related go.sum
checksum file into your project’s Git repo.
You may now structure your module as a single root package, and/or multiple packages in a subdirectory structure:
gorepo/
├── go.mod
├── go.sum
├── root.go
├── pkg1/
│ ├── lib.go
│ └── lib_test.go
└── pkg2/
└── code.go
With the implementation in place, you can now push it to Gemfury.
Prior to Go Modules, dependencies could only be downloaded using source control tools (Git, Bazaar, Subversion & Mercurial), and module names had to correspond to the location of the package. With Go 1.13’s modules proxy support, it is no longer required for a package to be fetchable at the URL location. However, we still recommend URL-like module names.