Skip to content

cmd/go: custom import path checking should not apply to github.com/xxx/yyy #10952

Closed
@rsc

Description

@rsc

I think we should probably relax things so that github.com/xxx/yyy does not get a custom import path check unless it has an import comment.

---------- Forwarded message ----------
From: Dan Kortschak [email protected]
Date: Thu, May 21, 2015 at 8:10 PM
Subject: proposal to make import path checking only error when custom import is defined
To: [email protected], Russ Cox [email protected]

The custom import path checking proposal[1] says, "The go command will
refuse to install a package with an import comment under any import path
except the one named in the comment." However, the current behaviour is
to refuse whenever there is a mismatch between the import path and the
repo does not match the root, irrespective of whether a custom import
was defined. To my reading the current behaviour is not what was
specified in the proposal.

This gets a number of user/developers who expect to be able to update
their package originally checked out with git: by using go get. An an
example is here[2].

There are two possible approaches to fixing this - both trivial,
depending on checking that p.ImportComment != "" in
cmd/go/downloadPackage[3] and either issuing a non-misleading error
(don't mention custom import paths since there was none) or just allow
the completion of the request.

Are either of these acceptable?

[1]https://golang.org/s/go14customimport
[2]https://groups.google.com/d/topic/golang-nuts/Zi-Kw2tbif8/discussion
[3]

if remote != repo {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions