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

[go modules] migrating to go modules #1052

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

benjaminch
Copy link
Contributor

This CL migrates prebid-server to Go Modules getting rid of dep.

Issue: #998

@benjaminch benjaminch force-pushed the move-to-go-modules branch 6 times, most recently from 99593a8 to ecbaf46 Compare October 1, 2019 19:16
@benjaminch benjaminch marked this pull request as ready for review October 1, 2019 19:17
@mansinahar mansinahar self-assigned this Oct 2, 2019
.travis.yml Outdated
@@ -1,20 +1,13 @@
language: go

go:
- '1.11.1'
- '1.11.13'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the Go 1.11.x version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't commented it, but because of golang/go#30446
1.11.4 would probably have fixed it but well, latest version cannot hurt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I was taking this change to mean that the lowest version of Go now supported is 1.11.13.

What do you think of including '1.11.4' as the first build target and mentioning in the docs that's it the minimum supported version? Then adding '1.11.x' and '1.12.x' for the latest version of both of those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's use > 1.11.4.
1.11 will be removed soon I guess since PBS supports only the last 2 Go versions (your PR is on its way for 1.13 #1058 :))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's a very good point.

Makefile Outdated
install:
export DEP_RELEASE_TAG=v0.4.1
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

# deps will clean out the vendor directory and use dep for a fresh install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update comment to reference go modules

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, Sure !

ENV CGO_ENABLED 0
COPY ./ ./
RUN dep ensure && \
go build .
RUN go build -mod=vendor .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you recommend using the vendor directory versus the default $GOPATH\pkg\mod directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preferences, but IMO modules allowing to work outside of the GOPATH is one of the best features, so just wanted to take this opportunity :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not opposed :), was just curious if you ran into an issue specific to building the Docker container. I like that it allows for a more targeted cache clean by the deps command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's ok for you this way? Also, I might introduce in another PR later a GOPROXY for modules to speed up the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I don't see a problem with it.

The proxy sounds interesting. I'm curious to see what that looks like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SyntaxNode , here you go for the proxy: #1079 :)

SyntaxNode
SyntaxNode previously approved these changes Oct 8, 2019
@benjaminch
Copy link
Contributor Author

Thanks @SyntaxNode :)

@stale
Copy link

stale bot commented Oct 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 15, 2019
@@ -18,20 +18,15 @@ For more information, see:

## Installation

First install [Go 1.11](https://golang.org/doc/install) or later and [dep](https://golang.github.io/dep/docs/installation.html). Note that dep requires an explicit GOPATH to be set.
First install [Go 1.11](https://golang.org/doc/install) latest version (1.11.4) or later.
Note that prebid-server is using [Go modules](https://blog.golang.org/using-go-modules).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a note here to set GO111MODULE=on if you're using Go version <1.13 and are inside GOPATH. We can remove that after we stop supporting Go versions <1.13

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ! I'll do :)

@echo " test: test prebid-server (via validate.sh)"
@echo " build: build prebid-server"
@echo " image: build docker image"
@echo ""

.PHONY: install deps test build image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for removing the PHONY targets? Generally, it is recommended that any target in the makefile that doesn't result into an actual file with the same name should be listed as a PHONY target.

More info about PHONY targets: https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are right, I just wanted to remove the deps part :)

@stale stale bot removed the stale label Oct 16, 2019
@benjaminch benjaminch force-pushed the move-to-go-modules branch 2 times, most recently from 0260fee to 88be9cf Compare October 17, 2019 07:13
SyntaxNode
SyntaxNode previously approved these changes Oct 17, 2019
Dockerfile Outdated
COPY static static/
COPY stored_requests/data stored_requests/data
RUN apt-get update && \
apt-get install -y ca-certificates mtr && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't catch this earlier but any reason to remove the ca-certificates and mtr package installation? I am not a 100% sure if we even need it in the first place. Likely not and therefore this should be fine but I just wanna confirm. Also, we should still at least keep the apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* clean up command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise. Thanks @benjaminch :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, let's keep it all then, no real reasons here :)

This CL migrates prebid-server to Go Modules getting rid of `dep`.

Issue: prebid#998
Copy link
Contributor

@mansinahar mansinahar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this @benjaminch :)

@mansinahar mansinahar merged commit 01fb371 into prebid:master Oct 17, 2019
@benjaminch
Copy link
Contributor Author

Thanks a lot @mansinahar and @SyntaxNode :)

@SyntaxNode SyntaxNode mentioned this pull request Oct 18, 2019
mansinahar pushed a commit to mansinahar/prebid-server that referenced this pull request Nov 1, 2019
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 1, 2020
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 2, 2020
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 4, 2020
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 this pull request may close these issues.

3 participants