1

I want to push to gitlab from a go program. I'm using go-git v5 for it. The standard push is working fine:

err := repo.Push(&git.PushOptions{
            RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"},
            Progress: os.Stdout,
        })

Now I want to add a custom gitlab push option "ci.skip".

The git command would be git push -o ci.skip. I tried adding Options like this:

err := repo.Push(&git.PushOptions{
        RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"},
        Progress: os.Stdout,
        Options: map[string]string{"ci.skip":"true"},
    })

but the compiler tells me

p.Options undefined (type *git.PushOptions has no field or method Options)

I don't really get it as the PushOptions struct clearly has this property. I'm pretty new to Go, so I probably miss some concept here.

torek
  • 448,244
  • 59
  • 642
  • 775
gausss
  • 343
  • 2
  • 4
  • 16
  • 1
    `PushOptions` is new after version 5.4.2, i.e., it's not in any *release* version. See commit `e729edb00d36e9bd19f99dfa493984233b0dccfa`, added 26 Oct 2021. – torek Jan 26 '22 at 01:55
  • Wow, not released yet. Thanks for the hint. If you write an answer instead of a comment I'll accept it ;). – gausss Jan 26 '22 at 08:03

0 Answers0