0
votes

I'm trying to deploy a Go Web application using mux for routing, onto Cloud Foundry. My application contains a couple of other dependencies as well, mentioned below. However, there is a problem with either the go.mod file, the manifest file, or the gorilla/mux repository's go.mod file (which is highly unlikely).

This is the go.mod file that's created on entering go mod init and then go build .

module deployment_automation_tool

go 1.15

require (
    github.com/gorilla/mux v1.8.0
    github.com/jinzhu/gorm v1.9.16
    github.com/mattn/go-sqlite3 v1.14.6
)

This is the manifest:

---
applications:
  - name: deployment_automation_tool
    buildpacks:
      - go_buildpack
    env:
      GOPACKAGENAME : deployment_automation_tool

However, I keep getting this error:

 **ERROR** problem retrieving main package name: go: github.com/gorilla/[email protected]: reading github.com/gorilla/mux/go.mod at revision v1.8.0: unknown revision v1.8.0

 **ERROR** Unable to determine import path: exit status 1
   Failed to compile droplet: Failed to run finalize script: exit status 12
   Exit status 223
1
Just a quick question. Does your foundation have Internet access? Go seems to be having issues fetching a dependency, it would get that from the Internet. Many CF foundations have restricted Internet access, so verifying you can connect to Github from inside a container would be a good first step. You may need to enable a proxy to access the Internet, if access is restricted by your platform operations team. - Daniel Mikusa
Although it exists within a firewall, It does have internet access. I initially had that concern as well, but it seems to be an issue with Go modules rather than the internet connectivity - Devansh Purohit

1 Answers

0
votes

I solved this issue, by using dep, instead of Go modules. It's mentioned in its official docs that it is deprecated, but I found that to work with the go_buildpack perfectly. I'll update the answer if I find a way to push this to CF with go modules.