Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

go.testFlags when using -args fails because -coverprofile appended to arg list #2457

Closed

Description

When using custom test flags in the Go extension with the setting go.testFlags, where the custom flags include -args as per https://golang.org/cmd/go/#hdr-Test_packages, the command line generated has -coverprofile added to the end, causing the go test call to fail with:

flag provided but not defined: -coverprofile

The flags defined in the settings.json are:

    "go.testFlags": [
        "-args",
        "-f",
        "${workspaceRoot}/configs/testconfig.yaml",
        "-r",
        "${workspaceRoot}/shippable/testresults"
    ],

The expected command line should be:

/usr/bin/go test -timeout 120s github.com/gluexchange/catalog-manager-svc/pkg/dataaccess/productcatalog/arangodb -coverprofile=/tmp/vscode-goTN0OVm/go-code-cover -args -f path-to-rootdir/configs/testconfig.yaml -r path-to-rootdir/shippable/testresults

The actual command line generated by the Go extension is:

/usr/bin/go test -timeout 120s github.com/gluexchange/catalog-manager-svc/pkg/dataaccess/productcatalog/arangodb -args -f path-to-rootdir/configs/testconfig.yaml -r path-to-rootdir/shippable/testresults -coverprofile=/tmp/vscode-goTN0OVm/go-code-cover

This looked like it had been fixed in the following PR: #1976

But it looks like it might have been regressed by this commit in the goCover.ts file: b44bb8a#diff-869d156f8d53e34e379625eb2aab2d2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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