Questions tagged [go-modules]

A module is a collection of related Go packages. Modules are the unit of source code interchange and versioning. The go command has direct support for working with modules, including recording and resolving dependencies on other modules. Modules replace the old GOPATH-based approach to specifying which source files are used in a given build.

The Go Module concept was first published by Russ Cox here: Defining Go Modules.

Module support first appeared in Go 1.11 (in preliminary phase).

The go tool has built-in and extensive support for modules, documentation can be found at Go tool: Module maintenance and at Modules, module versions, and more. The command go help mod also provides sufficient details.

570 questions
0
votes
1 answer

Originating proxy of downloaded module

Say you are using Go 1.13 and set up a project initialized for Go Modules. $ mkdir my-project $ cd my-project $ git mod init github.com/bmuschko/my-project Instead of using the default Google proxy to download dependencies, you set GoCenter or a…
Benjamin Muschko
  • 32,442
  • 9
  • 61
  • 82
0
votes
1 answer

Go modules when running get vs build

I have a project where I use go modules. There I need to specify that I depend on a particular fork of a library (call it ), because it has an important patch. When I run go get -u , I get a compilation error that clearly means that go…
mcsim
  • 1,647
  • 2
  • 16
  • 35
0
votes
1 answer

Go modules replaces an explicit version with v0.0.0-- in go.mod

I recently added a feature to my Go project which might break other projects that uses it. I decided to bump a major version to this project, "A", by adding a matching git tag 2.0.0 (it was previously 1.x.x). In my other project which requires it,…
Kludge
  • 2,653
  • 4
  • 20
  • 42
0
votes
1 answer

How to modify and maintain an imported go dependency?

In my go app(parent), I import a go library(child) through go get and copy it to the parent directory. For my use, I make some modifications in "child" for extending certain features. I use go module and use "replace" in go.mod to point to the local…
pauljeba
  • 760
  • 2
  • 10
  • 27
0
votes
1 answer

Replace string in go.sum

How can i replace a string in go.sum. I use one SDK and it contains a strange import, that import is incorrect, the path of that library was changed to another, and when i do go mod init this incorrect import writes to go.sum.
godvlpr
  • 141
  • 1
  • 3
  • 11
0
votes
1 answer

How to use private go package with modules

I have a project which is providing an API but not under github.com, it’s under github.ny.nts.com How can I use it on my code? I’ve added to a new program and in the import I put: import “github.ny.nts.com/fds/client” Now when I run go mod init it…
Jon lib
  • 139
  • 2
  • 7
0
votes
1 answer

When i add go mod to my project, a can't run it, how can i fix it?

I wrote an app and when i add go modules to my project go mod init and try to start go run app.go i had an error: build command-line-arguments: cannot load github.com/nicksnyder/go-i18n/i18n: module github.com/nicksnyder/go-i18n@latest…
godvlpr
  • 141
  • 1
  • 3
  • 11
0
votes
1 answer

How to distinct what dependencies are downloadable?

I use this code to get a list of dependencies imported in a single Go source file: // GetFileImports returns all the imports from the Golang source code file. func GetFileImports(filepath string) ([]string, error) { fset := token.NewFileSet() …
zergon321
  • 210
  • 1
  • 10
0
votes
1 answer

Golang Module Use

I am trying to link to some code online: https://github.com/TheCacophonyProject/audiobait I am helping out with this project and have altered that repository to create a new package called audiofilelibrary. I am then trying to use that code in a…
davo36
  • 694
  • 9
  • 19
0
votes
1 answer

Go Modules management

While I try to build I am getting the following error: go.mod requires settings-management-service but vendor/modules.txt does not include it. run 'go mod tidy; go mod vendor' to sync I tried running go mod tidy; go mod vendor, but didn't help.
0
votes
2 answers

Golang go get failed with git ls-remote -q using the wrong url @ Go 1.13

Ok according to https://github.com/golang/go/issues/34094, go 1.13.3 fixed this problem Env: Go 1.13, Windows I got a fresh copy of Go on a Windows machine and try to build my project here. However, the mod which used to work is failing right…
idler1515
  • 150
  • 3
  • 11
0
votes
1 answer

Incorrect path name where build in Jenkins

I cannot build my apps on Jenkins. I try build it locally and it works. My apps using go wrapper and go mod this is what jenkins result according to the failure: ./build.sh: 6: ./build.sh: [[: not found go get .: path…
0
votes
2 answers

How to fix gomod: `github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github.com/stretchr/testify"`

When I do a go mod tidy. I got the following error: go: github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github.com/stretchr/testify"
Luc DUZAN
  • 1,299
  • 10
  • 18
0
votes
1 answer

Best practice(s) with Go Modules

I'm "all in" on Go Modules. Mostly, I prefer the experience. In Go development, I've -- perhaps like many others -- treated dependencies as if I worked in a mono repo, each of my projects had its own GOPATH and I'd often clone from scratch and pull…
DazWilkin
  • 32,823
  • 5
  • 47
  • 88
0
votes
2 answers

Is there an easier way to keep local Go packages updated

I am using multiple packages that I import into different projects, these range from custom adapters for my business logic that are shared by lambda and google cloud functions and other public packages. The way I do this right now is that I vendor…
automaticAllDramatic
  • 2,025
  • 1
  • 21
  • 25