Skip to content

Problem when cross-compiling on Linux for OSX #176

@christian-kreuzberger-dtx

Description

Hi.

We're using v0.6.3 of this package, and we run into the following problem when cross-compiling under Linux:

build my-binary: cannot find module for path github.com/docker/docker-credential-helpers/registryurl

The build commands we are using is

env GOOS=darwin GOARCH=amd64 go mod download
env GOOS=darwin GOARCH=amd64 go build -v -x  -o my-binary

I'm experiencing this problem with Go 1.12 on Ubuntu 18.04 as well as on Travis-CI using the following setup:

sudo: true
os: linux
language: go
go:
  - 1.12.x
env:
  global:
    - GO111MODULE=on
    - GOPROXY=https://proxy.golang.org

Building for Linux and Windows works fine. Building the library on osx works fine too. We do not import github.com/docker/docker-credential-helpers/registryurl at all.

My handler_darwin.go looks as follows:

package credentialmanager

import (
	"net/url"

	"github.com/docker/docker-credential-helpers/osxkeychain"
)

// SetCreds stores the credentials consisting of an endpoint and an api token in the keychain.
func SetCreds(endPoint url.URL, apiToken string) error {
	return setCreds(osxkeychain.Osxkeychain{}, endPoint, apiToken)
}

// GetCreds reads the credentials and returns an endpoint, the api token, or potentially an error.
func GetCreds() (url.URL, string, error) {
	return getCreds(osxkeychain.Osxkeychain{})
}

// SetInstallCreds sets the install credentials
func SetInstallCreds(creds string) error {
	return setInstallCreds(osxkeychain.Osxkeychain{}, creds)
}

// GetInstallCreds gets the install credentials
func GetInstallCreds() (string, error) {
	return getInstallCreds(osxkeychain.Osxkeychain{})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions