nomad-software / vend Goto Github PK
View Code? Open in Web Editor NEWA dependency vendor for Go programs
License: MIT License
A dependency vendor for Go programs
License: MIT License
Hi there.
Is there a website for this repo?
Because if you don't have, well, this repo can simply be turned into a website right away. Others will discover this project in that website.
Steps:
Go to Settings and look for GitHub Pages
, scroll down. That's almost at the bottom.
You will see there: Branch:none
, so you should change that to master
because you have a README.md
file in the master repo. This will be your page. Click Save
first.
Then click Choose a theme
, you select a predefined theme of your site.
Visit your site now! The URL will be https://nomad-software.github.io/vend
.
If you were amazed by that, simply read the documentation about GitHub Pages.
Without these tags go 1.14 errors with {module} is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
Example: https://golang.org/src/vendor/modules.txt
I'm currently getting around this by running go mod vendor
, saving their version of modules.txt, running vend, then overriding the new modules.txt with the go mod version. I did notice that the files are different with go mod listing more sub-paths of modules and outright excluding others. This is for an internal project so I can't really share a working example, sorry.
If a vendored module has //go:build go1.18
lines while running go1.17 then running gofmt -l .
(as a CI formatting check, for example) errors out because go1.17 doesn't understand go1.18 generics syntax. Seems like go vet
and go build
are smart enough to avoid those files, however. Can work around this with a more complex gofmt
line that avoids vendor
directory, like find . \( -path ./vendor -prune \) -o -type f -name \*.go -print0 | xargs -0 gofmt -l
, so not sure exactly how urgent this is, but a parameter to avoid them would help.
Example Go file:
package main
import (
"fmt"
"golang.org/x/tools/godoc/util"
)
func main() {
fmt.Println(util.IsText([]byte("foo")))
}
go mod vendor
:
$ rm -rf vendor; go mod vendor; gofmt -l .; echo $?
0
vend
:
$ rm -rf vendor; go run --mod=mod github.com/nomad-software/vend > /dev/null; gofmt -l . 2>&1 | grep : | tail
go: finding module for package github.com/nomad-software/vend
vendor/golang.org/x/tools/internal/lsp/testdata/keywords/empty_select.go:7:1: expected declaration, found '}'
vendor/golang.org/x/tools/internal/lsp/testdata/keywords/empty_switch.go:9:3: expected '}', found d
vendor/golang.org/x/tools/internal/lsp/testdata/keywords/empty_switch.go:11:1: expected declaration, found '}'
vendor/golang.org/x/tools/internal/lsp/testdata/keywords/keywords.go:71:1: expected operand, found '}'
vendor/golang.org/x/tools/internal/lsp/testdata/keywords/keywords.go:100:52: expected ';', found 'EOF'
vendor/golang.org/x/tools/internal/lsp/testdata/snippets/literal.go:21:2: expected operand, found '}'
vendor/golang.org/x/tools/internal/lsp/testdata/snippets/literal.go:22:2: missing ',' in composite literal
vendor/golang.org/x/tools/internal/lsp/testdata/statements/if_err_check_return.go:22:2: expected boolean expression, found assignment (missing parentheses around composite literal?)
vendor/golang.org/x/tools/internal/lsp/testdata/statements/if_err_check_return.go:26:2: expected operand, found 'if'
vendor/golang.org/x/tools/internal/lsp/testdata/statements/if_err_check_return.go:27:3: expected '}', found 'EOF'
Hey
I got 1 issue and 1 doubt here.
1)Is vend accepts any arguments? I just want to download one package fully in vendor.
2)My golang code is using module https://github.com/confluentinc/confluent-kafka-go. Here they static library at the path /kafka/librdkafka_vendor i.e librdkafka_darwin.a librdkafka_glibc_linux.a librdkafka_musl_linux.a librdkafka_windows.a
I couldnt see these files after doing the vend
how to reproduce ?
in my case, it copies
~/src/qor-demo λ tree -L 1 vendor/
vendor/
├── github.com
├── go.uber.org
├── golang.org
└── modules.txt
at least qor/admin has no denpendency on zap or golang/x
Does this tool help to vendor proto files? I'm need it to generate my own code. Now i'm simply copy needed files to my local package proto dir
I... seriously.
$ go get github.com/nomad-software/vend
go: finding github.com/nomad-software/vend latest
go: finding golang.org/x/sys v0.0.0-20181218192612-074acd46bca6
go: downloading github.com/nomad-software/vend v0.0.0-20181222113412-fb70e2a0dee9
go: extracting github.com/nomad-software/vend v0.0.0-20181222113412-fb70e2a0dee9
$ cd <project directory in question>
$ vend
download:, exit status 1073741845
$ vend -package
tidy:, exec: "go": executable file not found in %PATH%
$ go
'go' is not recognized as an internal or external command,
operable program or batch file.
$ which go
which: no go in (C:\Program Files\...snip...)
$ dir c:\go\bin
Volume in drive C is OS
Volume Serial Number is 58BF-59A1
Directory of c:\go\bin
04/02/2019 10:16 AM <DIR> .
04/02/2019 10:16 AM <DIR> ..
02/25/2019 11:09 PM 17,127,424 godoc.exe
02/25/2019 11:09 PM 3,640,320 gofmt.exe
2 File(s) 20,767,744 bytes
2 Dir(s) 176,467,365,888 bytes free
Currently, only modules in the required modules list are copied into the vendor directory. However, go mod vendor
copies all dependencies. This includes modules in the requires modules list of dependencies that also use go modules. go build -mod=vendor
will fail with missing dependencies after vend
, but not after go mod vendor
in this case.
during copying, the original module path is used for the module source. if the module should be replaced via a replace statement in go.mod, then the replacing module path should be used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.