-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add brief notes on Golang module creation
- Loading branch information
1 parent
a1e2245
commit 6fe464d
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
I was using go version 1.22.4 while writing these notes. I do not | ||
know whether recommendations have changed across go versions. | ||
|
||
It seems to be recommended to have one module per revision-controlled | ||
repository, e.g. per Github repository. | ||
|
||
There should be a single `go.mod` and `go.sum` file in the root | ||
directory of the repository. | ||
|
||
Such a repository can have many separate programs, each with their own | ||
main package, preferably in different directories of the repo. | ||
|
||
To create the initial `go.mod` file for the repository, after Go is | ||
installed on the system so you can run `go` commands, change to the | ||
root directory of the repository and run this command: | ||
|
||
```bash | ||
go mod init wwwin-github.cisco.com/jafinger/misc | ||
``` | ||
|
||
Replace the URL with the URL of your repository. Omit any `https://` | ||
or `http://` prefix, and any `.git` suffix. |