Skip to content

go.test.previous: omits -run flag #269

Closed
@Asarew

Description

@Asarew

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

  • Run go version to get version of Go
    • go version go1.14.2 linux/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.46.1 - cd9ea6488829f560dc949a8b2fb789f3cdc05f5d - x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.15.0
  • Run go env to get the go development environment details
    • GO111MODULE=""
      GOARCH="amd64"
      GOBIN=""
      GOCACHE="/home/asare/.cache/go-build"
      GOENV="/home/asare/.config/go/env"
      GOEXE=""
      GOFLAGS=""
      GOHOSTARCH="amd64"
      GOHOSTOS="linux"
      GOINSECURE=""
      GONOPROXY=""
      GONOSUMDB=""
      GOOS="linux"
      GOPATH="/home/asare/.gvm/pkgsets/go1.14.2/global"
      GOPRIVATE=""
      GOPROXY="https://proxy.golang.org,direct"
      GOROOT="/home/asare/.gvm/gos/go1.14.2"
      GOSUMDB="sum.golang.org"
      GOTMPDIR=""
      GOTOOLDIR="/home/asare/.gvm/gos/go1.14.2/pkg/tool/linux_amd64"
      GCCGO="gccgo"
      AR="ar"
      CC="gcc"
      CXX="g++"
      CGO_ENABLED="1"
      GOMOD="/home/asare/Projects/project/go.mod"
      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-build385115887=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

{
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
    "go.coverOnTestPackage": false,
    "search.quickOpen.includeHistory": false,
    "go.buildOnSave": "off",
    "go.installDependenciesWhenBuilding": false,
    "go.testFlags": [
        "-v", "-count=1"
    ],
   "go.lintTool": "golint",
    "go.lintFlags": [
        "--fast",
        "comment\\s+or\\s+be\\s+unexported"
    ],
    "[go]": {
        "editor.snippetSuggestions": "none",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
}

Describe the bug

When running a specific test by clicking the run test link above a test func, the command is executed:

Running tool: /home/asare/.gvm/gos/go1.14.2/bin/go test -timeout 10s gitlab.com/asare/project -run ^TestFuncName$ -v -count=1

when then running the Go: previous test action it runs the last test without the -run flag, resulting in the entire package being tested.

Steps to reproduce the behaviour:

  1. create a new test file with something like:
package random_test

import "testing"

func TestRandom(t *testing.T) {}
  1. Click on run test above TestRandom
  2. Run the Go: Test Previous action from ctrl+shift+p

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions