stellar-deprecated / kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
https://kelpbot.io
Other
1.09k stars 262 forks source link

Build error: github.com/lechengfan/googleauth #705

Closed ddombrowsky closed 2 years ago

ddombrowsky commented 3 years ago

Describe the bug

The source code will not build for me from the master branch. I have encountered this error before and have been able to work around it, but I have yet to identify the root cause.

Expected behavior

Running ./scripts/build.sh should build the binary.

Frequency

Every time I refresh the dependencies for a new build from source.

Steps To Reproduce

Following https://github.com/stellar/kelp#compile-from-source , I get to the step to run ./scripts/build.sh, which always results in

...
go: downloading github.com/Beldur/kraken-go-api-client v0.0.0-20210512194559-2c29669c4ecc
go: extracting github.com/Beldur/kraken-go-api-client v0.0.0-20210512194559-2c29669c4ecc
go: std/github.com/stellar/kelp imports
        github.com/stellar/kelp/cmd imports
        github.com/stellar/kelp/support/networking imports
        github.com/lechengfan/googleauth: github.com/lechengfan/googleauth@v0.1.0: parsing go.mod:
        module declares its path as: github.com/kr/githubauth
                but was required as: github.com/lechengfan/googleauth

Possible Solution

I would love to know the root cause of this so I can avoid working around it every time I need to build the binary.

Your Environment

Linux 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux go version: go version go1.13.8 linux/amd64

ddombrowsky commented 3 years ago

so far, all workarounds that worked before have failed.

Patch used:

+++ b/support/networking/server.go
@@ -11,7 +11,6 @@ import (
        "time"

        "github.com/go-chi/chi"
-       "github.com/lechengfan/googleauth"
 )

 // Config is a struct storing configuration parameters for the monitoring server.
@@ -104,14 +103,7 @@ func (s *server) googleAuthHandler(h http.Handler) http.Handler {
                panic(e)
        }
        k := sha256.Sum256(key)
-       return &googleauth.Handler{
-               PermittedEmails: s.permittedEmails,
-               Keys:            []*[32]byte{&k},
-               ClientID:        s.googleClientID,
-               ClientSecret:    s.googleClientSecret,
-               MaxAge:          28 * 24 * time.Hour,
-               Handler:         h,
-       }
+       return nil
 }

No luck.

ddombrowsky commented 3 years ago

Tried on versions 1.16 and latest 1.14 of go. No luck. After hours of this I am totally baffled how I ever got this to build.

ddombrowsky commented 3 years ago

I was finally able to get a build, but no idea why.

I reset back to v1.9.0 and then ran

glide install
./scripts/build.sh

and it built correctly.

Then I reset back to master, and did the same thing, without running a clean or anything.

./bin/kelp version
  cli version: master:v1.11.0-20-g4db12f85
  gui version: v1.0.0-rc2
  git branch: master
  git hash: 4db12f85b6b838e78ce8e84bbaa99aa59dd52549
  build date: 20210623T183453Z
  build type: cli
  env: dev
  GOOS: linux
  GOARCH: amd64

This worked with go version go1.13.8 linux/amd64. Looks like there's a bug somewhere with a clean checkout of master. At least there is in my environment.

nikhilsaraf commented 3 years ago

It may be that something changed in a later version of go which broke this -- I'm using go 1.13.4 which works. I haven't tested on later go versions.

I think the workaround for now may be to use go 1.13.

I've unfortunately been caught up with other items of work that have prevented me from making upgrades to Kelp and am relying on workarounds. That's not he best experience but until I'm able to spend more time on this I don't think I will be able to get to it. If someone in the open-source community is able to fix this issue and submit a PR (or tag me here and we can set up a call to discuss) then that would be great!

Keeping this issue open.

clD11 commented 2 years ago

@nikhilsaraf I think you can close with the mod upgrade

nikhilsaraf commented 2 years ago

closing with the migration of go modules in this issue: https://github.com/stellar/kelp/issues/277