Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Cannot ignore local packages to be downloaded into /vendor folder and Gopkg.lock #1775

Closed
DJviolin opened this issue Mar 24, 2018 · 3 comments

Comments

@DJviolin
Copy link

DJviolin commented Mar 24, 2018

I have the following Gopkg.toml file:

ignored = ["github.com/DJviolin/my-repository"]

[[constraint]]
  name = "github.com/flosch/pongo2"
  version = "3.0.0"

[[constraint]]
  name = "github.com/gorilla/handlers"
  version = "1.3.0"

[[constraint]]
  name = "github.com/gorilla/mux"
  version = "1.6.1"

[prune]
  go-tests = true
  unused-packages = true

The project structure: every source code is presented under %GOPATH%/src/github.com/DJviolin/my-repository in a folder named src. The microservices are organized into subfolders like static/main.go and it's local packages in subfolders. These local packages re-downloaded into /vendor, despite I don't want that and I used the ignored deritative in Gopkg.toml.

What version of dep are you using (dep version)?

v0.4.1-122-g42e3d76d

What dep command did you run?

$ dep ensure -v
$ dep ensure -update -v

What did you expect to see?

I want to completely ignore the github.com/DJviolin/my-repository from Gopkg.lock and /vendor folder, because this is the repository where I developing it, simply put, I don't want to download few files from Github, instead use the local ones.

What did you see instead?

Some folders still presented in /vendor folder.

@DJviolin
Copy link
Author

Looks like using a wildcard at the end solved it: ignored = ["github.com/DJviolin/my-repository*"]

@sdboyer
Copy link
Member

sdboyer commented Mar 24, 2018

I don't want to download few files from Github, instead use the local ones.

i'm glad you found the solution here, but please note that what you're trying to accomplish is the multi-project workflow, and it's likely going to give you some headaches. See, most recently, #1768.

@DJviolin
Copy link
Author

DJviolin commented Mar 25, 2018

I re-inited my dep project from start, because I have some problem with the go build command. I had mixed lower-uppercase letters in my username, so I renamed it to all lowercase in the path and .go files. Now the dep init command doesn't bring in the local packages from this project.

Maybe the issue was there on the first place, because I used all lowercase letters in my local paths, but sometimes I referenced my name as DJviolin in the Go files: %GOPATH%/src/github.com/djviolin/my-repository?

My Github username have uppercase letters, but I guess the local environment uneffected by this.


I building the binaries with these commands in a Makefile:

CURRENT_DIR ::= $(shell pwd)
BUILD_DIR ::= $(CURRENT_DIR)/build

build_static:
	cd $(CURRENT_DIR); \
	$(BUILD) -o $(BUILD_DIR)/static $(LDFLAGS) $(CURRENT_DIR)/src/static/main.go

...

run_static:
	cd $(BUILD_DIR); \
	GOMAXPROCS=1 ./static -logging=true -compress=false

CURRENT_DIR is the project's root dir, where dep is also inited and where the /vendor folder also presents: %GOPATH%/src/github.com/djviolin/my-repository

I define main.go explicitely, because I want to start go build command in the same dir where /vendor folder is presented, or this is totally unnecessary step?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants