Skip to content

Error with go module and git submodules #414

Closed
@pascencio

Description

@pascencio

Hi guys,

I have some troubles with the extension and git submodules.

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go1.14.5 linux/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.48.0-insider
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.15.2
  • Run go env to get the go development environment details
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/patricio/.cache/go-build"
GOENV="/home/patricio/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/patricio/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build939111051=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

{
    "go.autocompleteUnimportedPackages": true,
    "go.formatTool": "goimports",
    "go.buildOnSave": "workspace",
    "go.useLanguageServer": true
}

Describe the bug

Problem

I have a project with two components:

  1. Backend with golang using go modules.
  2. Frontend with vue

Both components are git submodules in a parent repository. When I open the project with both submodules I have the following issues:

  1. Module dependencies are not imported (autocompleteUnimportedPackages)
  2. Error with packages already imported

Opening directly submodule resolves the issue.

Behavior expected

I expect same behavior with git submodules and simple git project.

Steps to reproduce the behavior:

  1. Clone a project with git submodules (with golang modules inside).
  2. Init and update submodules.
  3. Open main.go file
  4. See errors in packages imported already declared in go.mod file.

Screenshots or recordings

Project opened with git submodules:

image

Project opened directly:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeupstream-toolsIssues that are caused by problems in the tools that the extension depends on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions