Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do you build? #858

Open
xin-at-marathon opened this issue Jun 14, 2022 · 3 comments · May be fixed by #860
Open

how do you build? #858

xin-at-marathon opened this issue Jun 14, 2022 · 3 comments · May be fixed by #860

Comments

@xin-at-marathon
Copy link

This is the 1st time I try to build confd.

go version
go version go1.18.3 linux/amd64
export GOPATH=/data

I follow the instruction:

$ mkdir -p $GOPATH/src/github.com/kelseyhightower
$ git clone https://github.com/kelseyhightower/confd.git $GOPATH/src/github.com/kelseyhightower/confd
$ cd $GOPATH/src/github.com/kelseyhightower/confd
$ make

then I got error:

Building confd...
go: cannot find main module, but found Gopkg.lock in /data/src/github.com/kelseyhightower/confd
        to create a module there, run:
        go mod init
make: *** [build] Error 1

If I run go mod init, I will get:

go mod init
go: creating new go.mod: module github.com/kelseyhightower/confd
go: copying requirements from Gopkg.lock
go: to add module requirements and sums:
        go mod tidy

If I run go mod tidy, I will get:

……
……
……
go: found github.com/armon/go-radix in github.com/armon/go-radix v1.0.0
go: found github.com/hashicorp/go-memdb in github.com/hashicorp/go-memdb v1.3.3
go: found github.com/hashicorp/golang-lru in github.com/hashicorp/golang-lru v0.5.4
go: found github.com/keybase/go-crypto/openpgp in github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
go: found github.com/keybase/go-crypto/openpgp/packet in github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4                                                                                                                     
go: found github.com/mitchellh/go-testing-interface in github.com/mitchellh/go-testing-interface v1.14.1
go: found github.com/patrickmn/go-cache in github.com/patrickmn/go-cache v2.1.0+incompatible
go: found github.com/ghodss/yaml in github.com/ghodss/yaml v1.0.0
go: found github.com/grpc-ecosystem/grpc-gateway/runtime in github.com/grpc-ecosystem/grpc-gateway v1.16.0
go: found github.com/tmc/grpc-websocket-proxy/wsproxy in github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75                                                                                                              
go: found github.com/prometheus/client_golang/prometheus in github.com/prometheus/client_golang v1.12.2
go: found github.com/jonboulle/clockwork in github.com/jonboulle/clockwork v0.3.0
go: found golang.org/x/time/rate in golang.org/x/time v0.0.0-20220609170525-579cf78fd858
go: found github.com/xiang90/probing in github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2
go: found golang.org/x/sync/errgroup in golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
go: found github.com/golang/glog in github.com/golang/glog v1.0.0
go: found github.com/coreos/bbolt in github.com/coreos/bbolt v1.3.6
go: found github.com/hashicorp/go-plugin in github.com/hashicorp/go-plugin v1.4.4
go: found github.com/hashicorp/go-version in github.com/hashicorp/go-version v1.5.0
go: found github.com/grpc-ecosystem/grpc-gateway/utilities in github.com/grpc-ecosystem/grpc-gateway v1.16.0
go: found github.com/google/btree in github.com/google/btree v1.1.1
go: found github.com/golang/groupcache/lru in github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: found github.com/hashicorp/yamux in github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87
go: found github.com/duosecurity/duo_api_golang in github.com/duosecurity/duo_api_golang v0.0.0-20220428205559-fa137a8ef05b                                                                                                                  
go: found github.com/duosecurity/duo_api_golang/authapi in github.com/duosecurity/duo_api_golang v0.0.0-20220428205559-fa137a8ef05b                                                                                                          
go: found github.com/gocql/gocql in github.com/gocql/gocql v1.1.0
go: found github.com/SAP/go-hdb/driver in github.com/SAP/go-hdb v0.106.1
go: found gopkg.in/mgo.v2 in gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
go: found github.com/denisenkom/go-mssqldb in github.com/denisenkom/go-mssqldb v0.12.2
go: found github.com/go-sql-driver/mysql in github.com/go-sql-driver/mysql v1.6.0
go: found github.com/lib/pq in github.com/lib/pq v1.10.6
go: github.com/kelseyhightower/confd/backends/etcdv3 imports
        github.com/coreos/etcd/clientv3 tested by
        github.com/coreos/etcd/clientv3.test imports
        github.com/coreos/etcd/auth imports
        github.com/coreos/etcd/mvcc/backend imports
        github.com/coreos/bbolt: github.com/coreos/bbolt@v1.3.6: parsing go.mod:
        module declares its path as: go.etcd.io/bbolt
                but was required as: github.com/coreos/bbolt

If I run make AGAIN, I'll get this error:

make
Building confd...
go: inconsistent vendoring in /data/src/github.com/kelseyhightower/confd:
        github.com/BurntSushi/toml@v0.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/aws/aws-sdk-go@v1.13.41: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/coreos/etcd@v3.3.4+incompatible: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/coreos/go-semver@v0.2.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/fsnotify/fsnotify@v1.4.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/garyburd/redigo@v1.6.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/go-ini/ini@v1.36.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/gogo/protobuf@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/golang/protobuf@v1.1.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/golang/snappy@v0.0.0-20170215233205-553a64147049: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/consul@v1.0.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/errwrap@v0.0.0-20141028054710-7554cd9344ce: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/go-cleanhttp@v0.0.0-20171218145408-d5fe4b57a186: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/go-multierror@v0.0.0-20171204182908-b7773ae21874: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/go-rootcerts@v0.0.0-20160503143440-6bb64b370b90: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/go-sockaddr@v0.0.0-20180320115054-6d291a969b86: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/hcl@v0.0.0-20180404174102-ef8a98b0bbce: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/serf@v0.8.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/hashicorp/vault@v0.10.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/jmespath/go-jmespath@v0.0.0-20160202185014-0b12d6b521d8: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/kelseyhightower/memkv@v0.1.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/mitchellh/go-homedir@v0.0.0-20161203194507-b8bc1bf76747: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/mitchellh/mapstructure@v0.0.0-20180220230111-00c29f56e238: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/ryanuber/go-glob@v0.0.0-20160226084822-572520ed46db: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/samuel/go-zookeeper@v0.0.0-20180130194729-c4fab1ac1bec: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/sethgrid/pester@v0.0.0-20180430140037-03e26c9abbbf: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/sirupsen/logrus@v1.0.5: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/ugorji/go@v1.1.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        github.com/xordataexchange/crypt@v0.0.3-0.20170626215501-b2862e3d0a77: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/crypto@v0.0.0-20180503215945-1f94bef427e3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/net@v0.0.0-20180502164142-640f4622ab69: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/sys@v0.0.0-20180504064212-6f686a352de6: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/text@v0.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        google.golang.org/genproto@v0.0.0-20180427144745-86e600f69ee4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        google.golang.org/grpc@v1.11.3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        gopkg.in/yaml.v2@v2.2.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

        To ignore the vendor directory, use -mod=readonly or -mod=mod.
        To sync the vendor directory, run:
                go mod vendor
make: *** [build] Error 1

any hint? please help.

@xin-at-marathon xin-at-marathon changed the title how do you guy build? how do you build? Jun 14, 2022
@eugenetaranov
Copy link

I was trying the same locally with up to date golang, also 1.10 - no luck.
Then I noticed it contains dockerfile in the repo root, built an image from it, installed gcc apk update; apk add gcc then make build and it worked

@RangerRick
Copy link

This is extremely gross, and I'm not super well-versed in the go build, but this is how I've gotten it to (seemingly 😅) build cleanly with go1.18.1:

cd "${GOPATH}/src/github.com/kelseyhightower/confd"
go mod init
go mod tidy -e -compat=1.10
go mod vendor 2>&1 | grep 'go get ' | while read LINE; do
    sh -c "$LINE"
done
go mod vendor
make

@yufeiminds yufeiminds linked a pull request Sep 8, 2022 that will close this issue
@yufeiminds
Copy link

@xin-at-marathon I tried to add go mod and go 1.19 support at #860 , You can use this version to build confd.

Need @kelseyhightower review.

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

Successfully merging a pull request may close this issue.

4 participants