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.

thisguy123
  • 939
  • 1
  • 9
  • 31
  • 1
    I'm only guessing (I prefer goland for its much much better debugger integration) but this looks like the cli and vscode are resolving different versions of a dependent library. Does VSCode have a setting to turn on gomodule support / vendoring? – Keynan Jan 28 '20 at 19:10
  • @Keynan - same behavior is observed in goland. Looking for tips on how exactly I could track down the dependency issues. – thisguy123 Jan 28 '20 at 19:44
  • in goland you can search actions (Ctrl + Shift + A) for vendor mode – Keynan Jan 29 '20 at 00:23
  • definitely dependency resolution issue, just developing in vscode containers resolved. – thisguy123 Feb 04 '20 at 04:38

0 Answers0