Skip to content

support go_library importpath_aliases when resolving modules #7194

@neskandary-vistar

Description

@neskandary-vistar

Description of the feature request:

Hi team,

Thanks for building and maintaining this plugin, I find it very useful. This may be just be something with me, but in the project I use this for, intellij does not seem to resolve a go module that uses an alias in importpath_aliases, it only works if I change the module to what the importpath is.

The go library is github.com/doug-martin/goqu/v9,

In my bazel workspace that is

go_repository(
        name = "com_github_doug_martin_goqu_v9",
        importpath = "github.com/doug-martin/goqu/v9",
        remote = "https://github.com/doug-martin/goqu",
        vcs = "git",
    )

The generated @com_github_doug_martin_goqu_v9///BUILD.bazel looks like

go_library(
    name = "goqu",
    srcs = [
        "database.go",
        "delete_dataset.go",
        "expressions.go",
        "goqu.go",
        "insert_dataset.go",
        "prepared.go",
        "select_dataset.go",
        "sql_dialect.go",
        "truncate_dataset.go",
        "update_dataset.go",
    ],
    importpath = "github.com/doug-martin/goqu/v9",
    importpath_aliases = ["github.com/doug-martin/goqu"],
    visibility = ["//visibility:public"],
    deps = [
        "//exec",
        "//exp",
        "//internal/errors",
        "//internal/sb",
        "//internal/util",
        "//sqlgen",
    ],
)

In my project, a bazel build file has a go_library that has the dep "@com_github_doug_martin_goqu_v9//:go_default_library",, I would like to use the importpath alias "github.com/doug-martin/goqu" in my go file when importing modules, but intellij cannot resolve that, it only does when I change it to "github.com/doug-martin/goqu/v9". Bazel still builds, it's the IDE support I am missing for this module

OSX 14.4, IntelliJ IDEA 2024.3.1 (Ultimate Edition), Bazel for Intellij 2024.11.19.0.3-api-version-243, Bazel 6.5.0

Thanks!

Which category does this issue belong to?

GoLand

What underlying problem are you trying to solve with this feature?

importing a go module via go_library importpath alias

What operating system, Intellij IDE and programming languages are you using? Please provide specific versions.

OSX 14.4, IntelliJ IDEA 2024.3.1 (Ultimate Edition), Bazel for Intellij 2024.11.19.0.3-api-version-243, Bazel 6.5.0

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions