Cloud-builders: Support Go Modules

Created on 25 Nov 2018  路  2Comments  路  Source: GoogleCloudPlatform/cloud-builders

The current usage of GOPATH is no compatible with Go Modules (at least the variant where you do not want to use a GOPATH). Is there already a concept how to support that?

Most helpful comment

Repos that build with Go 1.11+ and use Go modules don't actually need to use gcr.io/cloud-builders/go -- the main benefit of that builder is that it will arrange your repo into a location in GOPATH for you.

Instead, you can just use the official golang image from dockerhub. For example, the gcs-fetcher directory in this repo uses Go modules and it's build config uses this image.

We should document this better, and eventually deprecate our Go builder once Go module usage is more of a default.

All 2 comments

Repos that build with Go 1.11+ and use Go modules don't actually need to use gcr.io/cloud-builders/go -- the main benefit of that builder is that it will arrange your repo into a location in GOPATH for you.

Instead, you can just use the official golang image from dockerhub. For example, the gcs-fetcher directory in this repo uses Go modules and it's build config uses this image.

We should document this better, and eventually deprecate our Go builder once Go module usage is more of a default.

@ImJasonH I think this should be documented in https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/go/README.md for right direction for future users

even I was stuck for while with go modules with this image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DiederikvandenB picture DiederikvandenB  路  4Comments

acasademont picture acasademont  路  4Comments

mbana picture mbana  路  6Comments

leighmcculloch picture leighmcculloch  路  5Comments

namtzigla picture namtzigla  路  3Comments