draft-classic
draft-classic copied to clipboard
Go Modules support
Hi, I'm currently working on updating draft to work with go modules. This is the current progress:
- [x] Building and running draft outside the gopath
Following the official documentation, I went through the following process:
# clone outside GOPATH
$ git clone https://github.com/Azure/draft
$ cd draft
$ go mod init github.com/Azure/draft
go mod will then copy the dependency requirements from the existing Gopkg.lock.
$ go mod tidy
to clean up the dependencies , add missing ones and mark indirect dependencies. The results are this go.mod and this go.sum.
Now I can build and run draft outside the gopath.
$ go build ./...
$ go run ./cmd/draft
(I previously mentioned some dependency issues here but it turns out these were based on wrong assumptions - I thought I was already importing my fork with modules support but I was actually importing the remote version.) For documentation purposes I've stored them here)
Remaining issues with running the project outside of the gopath:
-
make bootstrapwon't work - but it is also not required, as go modules will make sure all the dependencies are installed. It can still be used -
failing unit tests (
make test-unit)
--- FAIL: TestStoreCreateBuild (0.00s)
store_test.go:128: failed equality for CreateBuild
--- FAIL: TestStoreUpdateBuild (0.00s)
store_test.go:128: failed equality for UpdateBuild
I'm not entirely sure why they fail. I haven't been able to spot anything usually handled by make bootstrap that would've been required.
The structs appear equal when I have a look at their fields.
got: buildID:"foo1" release:"bar1" contextID:"foobar1" created_at:<seconds:1557756090 nanos:889887465 >
obj: buildID:"foo1" release:"bar1" contextID:"foobar1" created_at:<seconds:1557756090 nanos:889887465 >
I'm not sure yet how to approach this issue.
Would you like me to open a PR anyway?
Some quick thoughts here:
- We're currently experimenting with migrating to go modules in Helm and have some concerns about maintaining the project compared to
dep's approach to dependency management, so we haven't invested much time in here. Once we're more familiar withgo modwe should be able to provide more opinions here for Draft make bootstrapcan go away withgo mod. That's not an issue :)- feel free to PR what you have. Perhaps someone from the community could take a look and provide some insight to your failed tests
Thanks for taking a look into this!
@nicmr
I looked into the failing tests and the reason they are failing is a field called XXX_sizecache within CreatedAt and for the obj it has a value of 12 and for got is has a value of 0.
This is the issue for both
- TestStoreUpdateBuild
- TestStoreCreateBuild