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

Convert to Go modules #25

Closed
wants to merge 1 commit into from
Closed

Convert to Go modules #25

wants to merge 1 commit into from

Conversation

croaky
Copy link
Contributor

@croaky croaky commented Aug 23, 2019

The Go language is making Go modules its official dependency mechanism.

This commit initializes Go modules and removes govendor references.

Go modules can be vendored, but don't need to.
This commit removes the vendor/ directory.

The Go language is make Go modules its official dependency mechanism.

https://www.kablamo.com.au/blog/2018/12/10/just-tell-me-how-to-use-go-modules

This commit initializes Go modules and removes `govendor` references.

Go modules can be vendored, but don't need to.
This commit removes the `vendor/` directory.
@croaky
Copy link
Contributor Author

croaky commented Aug 23, 2019

Testing deploy to Heroku. Before:

remote: -----> Installing go1.12.6
remote: -----> Fetching go1.12.6.linux-amd64.tar.gz... done
remote: -----> Fetching govendor... done
remote:  !!    Installing package '.' (default)
remote:  !!    
remote:  !!    To install a different package spec set 'heroku.install' in 'vendor/vendor.json'
remote:  !!    
remote:  !!    For more details see: https://devcenter.heroku.com/articles/go-apps-with-govendor#build-configuration
remote:  !!    
remote: -----> Fetching any unsaved dependencies (govendor sync)
remote: -----> Running: go install -v -tags heroku . 
remote: github.com/thoughtbot/rss/vendor/github.com/gorilla/feeds
remote: github.com/thoughtbot/rss/vendor/github.com/mattn/go-pkg-xmlx
remote: github.com/thoughtbot/rss/vendor/github.com/mattn/go-pkg-rss
remote: github.com/thoughtbot/rss
remote:        
remote:        Installed the following binaries:
remote:                 ./bin/rss

After:

remote:        Detected go modules via go.mod
remote: -----> 
remote:        Detected Module Name: github.com/thoughtbot/rss
remote: -----> 
remote:  !!    The go.mod file for this project does not specify a Go version
remote:  !!    
remote:  !!    Defaulting to go1.12.8
remote:  !!    
remote:  !!    For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
remote:  !!    
remote: -----> New Go Version, clearing old cache
remote: -----> Installing go1.12.8
remote: -----> Fetching go1.12.8.linux-amd64.tar.gz... done
remote: -----> Installing bzr 2.7.0
remote: -----> Fetching bzr-2.7.0.tar.gz... done
remote: -----> Installing hg 3.9
remote: -----> Fetching mercurial-3.9.tar.gz... done
remote: -----> Determining packages to install
remote:        
remote:        Detected the following main packages to install:
remote:                 github.com/thoughtbot/rss
remote:        
remote: -----> Running: go install -v -tags heroku github.com/thoughtbot/rss 
remote: go: finding github.com/mattn/go-pkg-xmlx v0.0.0-20180208005205-db53493302d1
remote: go: finding github.com/mattn/go-pkg-rss v0.0.0-20180208005446-cb3c88c0b82e
remote: go: finding github.com/gorilla/feeds v0.0.0-20170611032206-fa8f5548eedb
remote: go: downloading github.com/gorilla/feeds v0.0.0-20170611032206-fa8f5548eedb
remote: go: downloading github.com/mattn/go-pkg-rss v0.0.0-20180208005446-cb3c88c0b82e
remote: go: extracting github.com/gorilla/feeds v0.0.0-20170611032206-fa8f5548eedb
remote: go: extracting github.com/mattn/go-pkg-rss v0.0.0-20180208005446-cb3c88c0b82e
remote: go: downloading github.com/mattn/go-pkg-xmlx v0.0.0-20180208005205-db53493302d1
remote: go: extracting github.com/mattn/go-pkg-xmlx v0.0.0-20180208005205-db53493302d1
remote: github.com/gorilla/feeds
remote: github.com/mattn/go-pkg-xmlx
remote: github.com/mattn/go-pkg-rss
remote: github.com/thoughtbot/rss
remote:        
remote:        Installed the following binaries:
remote:                 ./bin/rss

https://gentle-lake-50705.herokuapp.com/

# Update Go dependencies
govendor sync
# Get dependencies
go get -u ./...

Choose a reason for hiding this comment

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

is the ./... just an alias for the repo url?

Copy link
Contributor Author

@croaky croaky Sep 5, 2019

Choose a reason for hiding this comment

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

The go get command adds dependencies (which could be "modules" or "packages")
to the current development module and then builds and installs them.

It accepts arguments and its first step is to resolve which dependencies to add.

We could provide a single name as an argument like
go get golang.org/x/text or we could provide patterns like
go get golang.org/x/perf/cmd/...

The argument is a pattern if it includes one or more ... wildcards.
A pattern expands to all package directories found in the directory tree
with names matching the patterns.

So, go get -u ./... is saying "get all the dependencies that are found
in this directory (./) and recursively within that directory (...)."

@@ -0,0 +1,6 @@
github.com/gorilla/feeds v0.0.0-20170611032206-fa8f5548eedb h1:ry27SfzOHgpUX1TXYh1W/kOUM7J+K8MdpRygT0DtHy0=

Choose a reason for hiding this comment

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

this was automatically generated? (I don't know go 😹)

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! It is generated. FAQs — go.mod and go.sum

Copy link

@bethanyhaubert bethanyhaubert left a comment

Choose a reason for hiding this comment

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

I don't know go, but I had some free time. 😸

@cpytel cpytel closed this Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants