Questions tagged [vgo]

16 questions
149
votes
4 answers

Accessing local packages within a go module (go 1.11)

I'm trying out Go's new modules system and am having trouble accessing local packages. The following project is in a folder on my desktop outside my gopath. My project structure looks like: / - /platform - platform.go - main.go -…
David Alsh
  • 6,747
  • 6
  • 34
  • 60
61
votes
3 answers

How to remove an installed package using go modules

I've installed a package using go modules (go get in Go 1.13) and now I want to remove it. In the documentation there is nothing about this and in go get docu neither. Removing the package from go.mod manually doesn't solve the issue so it remains…
jesugmz
  • 2,320
  • 2
  • 18
  • 33
46
votes
6 answers

Where is the module cache in golang?

When I enable gomodules and build my go program then the required packages are downloaded. But I cannot find them in $GOPATH/src/ or in $GOPATH/src/mod. Where are they stored? export GO111MODULE=on go mod init go build main.go go: finding…
christian
  • 9,412
  • 10
  • 41
  • 51
25
votes
5 answers

How do I resolve "cannot find module for path X" importing a local Go module?

In my Go project, I want to break out some generic functionality into a Go module, separate from the main project. I'm doing this outside of GOPATH in keeping with go's future. I don't want to publish the module on GitHub or anywhere else. All my…
Inigo
  • 12,186
  • 5
  • 41
  • 70
9
votes
4 answers

Go Mod Private Repo

So I have a private repo that my main.go imports. I'm getting this error when I do a go build: cannot find module for path Do I need to do anything special for a private repo? I have been googling and can't find any good information. It works fine…
user1179567
  • 163
  • 1
  • 2
  • 5
9
votes
2 answers

How to download all dependencies with vgo and a given go.mod?

I'm working on a go project, using vgo, with a Dockerfile, and I'd like docker to cache the dependencies of the project such that it has two properties: If the go.mod file changes, the dependencies will be re-downloaded If I change a file in the…
llimllib
  • 3,642
  • 1
  • 29
  • 29
8
votes
2 answers

How can I persist go 1.11 modules in a Docker container?

I am migrating a Go 1.10 app to Go 1.11. This also includes migrating from dep to mod for managing dependencies. As the application depends on a database, I am using a docker-compose to set up the local development environment. With Go 1.10 I simply…
m90
  • 11,434
  • 13
  • 62
  • 112
6
votes
2 answers

Import local Go module in Goland IDE

What is proper way to import (use) go module internally? For example: creating a new module by: go mod init example.com/my-project (example.com or another domain, which doesn't exist) and using it in the same project: import ( …
Ali Mamedov
  • 5,116
  • 3
  • 33
  • 47
2
votes
1 answer

Vgo and private repositories

I am trying to introduce vgo to some of our company projects for dependency management, but I've encountered some issues related to private repository. Let's assume that we have following code…
Alekc
  • 4,682
  • 6
  • 32
  • 35
2
votes
1 answer

Golang: How to use vgo? error: "cannot find package"

I have a project which is currently under my GOPATH /usr/local/go/src/ Then I went inside my project root and ran: go get -u golang.org/x/vgo In my main.go I want to use lib httprouter so I added in import statement: import ( …
CommonSenseCode
  • 23,522
  • 33
  • 131
  • 186
1
vote
1 answer

Most convenient way to work with local go dependencies?

I'm wondering how to work with local libraries. Let's say I want to develop two vgo projects in parallel, a my-project and a my-util project which is used by my-project. Of course my-util is available at a remote repository, but since it's not…
NotX
  • 1,516
  • 1
  • 14
  • 28
1
vote
1 answer

Go modules are not found using VGO and go.mod

I'm using versioned Go command to manage my vendors, everything is working but when I run go build it doesn't find my local packages I have set the module root inside my go.mod with I still get an error build foo: cannot find module for path The…
Jérôme
  • 1,966
  • 4
  • 24
  • 48
1
vote
0 answers

How to share a local module in Go 1.11+ for Golang using monolithic repo architecture outside GOPATH

Context: We are using a monolithic repository architecture. This means we have one big github repo with many projects, each project using its own tech stack for ui, node, go, etc. > /home/workspace/ > ./nodejs_project1 > …
bjm88
  • 690
  • 1
  • 8
  • 16
1
vote
1 answer

How do you create a local VGO application module

Every example I've seen with vgo so far requires you to write your module, upload it then create a new application module to test a basic module. Is there a way to test a module by skipping the repo step and just adding a package main to your module…
exts
  • 9,788
  • 4
  • 19
  • 21
0
votes
0 answers

How to import submodule of other project

I am trying to import the following git project github.com/tebeka/selenium When I use standard Go dependency management, it is as simple as go get github.com/tebeka/selenium, and then import ("github.com/tebeka/selenium" …
kubastick
  • 461
  • 6
  • 12
1
2