Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Go Modules support #934

Open
1 task done
nicmr opened this issue May 9, 2019 · 3 comments
Open
1 task done

Go Modules support #934

nicmr opened this issue May 9, 2019 · 3 comments

Comments

@nicmr
Copy link

nicmr commented May 9, 2019

Hi, I'm currently working on updating draft to work with go modules.
This is the current progress:

  • 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)

@nicmr
Copy link
Author

nicmr commented May 13, 2019

Remaining issues with running the project outside of the gopath:

  • make bootstrap won'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?

@bacongobbler
Copy link
Contributor

bacongobbler commented May 13, 2019

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 with go mod we should be able to provide more opinions here for Draft
  • make bootstrap can go away with go 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!

@ddymko
Copy link
Contributor

ddymko commented Oct 9, 2019

@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.

Screen Shot 2019-10-09 at 2 12 25 PM

This is the issue for both

  • TestStoreUpdateBuild
  • TestStoreCreateBuild

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

No branches or pull requests

3 participants