Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97327

Inconsistent Golang behavior between VSCode and CLI

$
0
0

I'm working with operator-sdk and am seeing inconsistent behavior between VSCode and the CLI.

When I run with operator-sdk run --local I see the below. But VSCode shows no errors. I'm not really sure why that might be or where the problem is.

pkg/controller/mypackage/mycontroller_controller.go:207:4: cannot use testRef (type *"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1".PipelineRef) as type "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1".PipelineRef in field value

The code in question looks like this.

    //...declaration
    testRef := &tekton.PipelineRef{
        Name: "mypipeline",
    }
    //..usage later...
    Spec: tekton.PipelineRunSpec{
            PipelineRef: testRef,
            Params: []tekton.Param{{

I'm using gomodules, and the relevant module is ->github.com/tektoncd/pipeline v0.10.0

I understand that this is something to do with pointer referencing, and when I change my code to

testRef := tekton.PipelineRef{
        Name: "mypipeline",
    }

Then VSCode shows an error like below, but the CLI doesn't report any errors.

cannot use testRef (variable of type v1alpha1.PipelineRef) as *v1alpha1.PipelineRef value in struct literal

Is this just a module dependency problem and my upstream API changed somewhere? Maybe my cli and VSCode are reading different dependencies? I don't even know where to start... Any pointers (pun intended) are appreciated.


Viewing all articles
Browse latest Browse all 97327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>