Skip to content

Commit

Permalink
Add brief notes on Golang module creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jafingerhut committed Jul 16, 2024
1 parent a1e2245 commit 6fe464d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions golang/creating-new-golang-module.md
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.

0 comments on commit 6fe464d

Please sign in to comment.