netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.82k stars 283 forks source link

make build fails #280

Closed jankohlbach closed 3 years ago

jankohlbach commented 3 years ago

- Do you want to request a feature or report a bug? a bug

- What is the current behavior? make build throws an error (Error 2)

exact output after make build:

go build -ldflags "-X github.com/netlify/gotrue/cmd.Version=`git rev-parse HEAD`"
# github.com/gobuffalo/uuid
/root/go/pkg/mod/github.com/gobuffalo/uuid@v2.0.5+incompatible/generator.go:32:13: undefined: uuid.NewV2
/root/go/pkg/mod/github.com/gobuffalo/uuid@v2.0.5+incompatible/uuid.go:41:7: undefined: uuid.V2
# github.com/netlify/gotrue/storage
storage/dial.go:71:36: not enough arguments in call to columns.ForStructWithAlias
        have (interface {}, string, string)
        want (interface {}, string, string, string)
make: *** [Makefile:10: build] Error 2

maybe cause of that: https://github.com/gobuffalo/pop/commit/c81c996fa04ca0c2f44b56ea5b7155991d6237ca

- If the current behavior is a bug, please provide the steps to reproduce.

mkdir -p $GOPATH/src/github.com/netlify
cd $GOPATH/src/github.com/netlify
git clone https://github.com/netlify/gotrue
cd gotrue
make deps
make build

- What is the expected behavior? successful build

- Please mention your Go version, and operating system version. ubuntu 20.04 go1.15.7

could need more instruction on how to set it up

codeplus254 commented 3 years ago

Got the same problem. How did you manage to fix it?

OS: centOS7 go1.16

jankohlbach commented 3 years ago

hey, sorry yeah I could fix it and actually want to do a tutorial on how to set up all of this because it was just a nightmare with that less documentation 😅

so there are two problems:

  1. the uuid go to the files

/root/go/pkg/mod/github.com/gobuffalo/uuid@v2.0.5+incompatible/generator.go:32:13 /root/go/pkg/mod/github.com/gobuffalo/uuid@v2.0.5+incompatible/uuid.go:41:7

and just comment the mentioned lines with v2 (32 and 41), don't know if it's important to keep, but without the two lines, it worked 🤷🏼‍♂️

  1. the function that needs one more parameter go to the file

storage/dial.go:71:36

here you need to change line 71 from:

cols := columns.ForStructWithAlias(model, sm.TableName(), sm.As)

to:

cols := columns.ForStructWithAlias(model, sm.TableName(), sm.As, sm.IDField())

how I found this: https://github.com/gobuffalo/pop/commit/c81c996fa04ca0c2f44b56ea5b7155991d6237ca

really hope this helps, guess there are not enoug people trying to set this up ... 😅

jankohlbach commented 3 years ago

apparently they have fixed it, not happened again for me for a new setup