diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-12-18 16:46:09 +0100 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-01-14 11:54:57 -0500 |
commit | d498ef53aa71066aec7771ebb7316bf3eb3d4cde (patch) | |
tree | 674db8a9dcc318832c253a49cc46d709d8bde3bd /pkg/bindings/generator/generator.go | |
parent | a944f906b8de00be0b50f9407d1905ba20f80823 (diff) | |
download | podman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.tar.gz podman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.tar.bz2 podman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.zip |
Makefile: add target to generate bindings
Add a `.generate-bindings` make target that only runs in the absence of
the `.generate-bindings` file or when a `types.go` file below
`pkg/bindings` has changed.
This will regenerate the go bindings and make sure the code is up2date.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/bindings/generator/generator.go')
-rw-r--r-- | pkg/bindings/generator/generator.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/bindings/generator/generator.go b/pkg/bindings/generator/generator.go index 8c79aebae..6a7f600a8 100644 --- a/pkg/bindings/generator/generator.go +++ b/pkg/bindings/generator/generator.go @@ -19,13 +19,10 @@ var bodyTmpl = `package {{.PackageName}} import ( {{range $import := .Imports}} {{$import}} {{end}} - ) /* This file is generated automatically by go generate. Do not edit. - -Created {{.Date}} */ // Changed @@ -52,6 +49,7 @@ func (o *{{.StructName}}) ToParams() (url.Values, error) { if !o.Changed(fieldName) { continue } + fieldName = strings.ToLower(fieldName) f := s.Field(i) if reflect.Ptr == f.Kind() { f = f.Elem() @@ -239,7 +237,7 @@ func main() { closed = true // go fmt file - gofmt := exec.Command("gofmt", "-w", "-s", out.Name()) + gofmt := exec.Command("go", "fmt", out.Name()) gofmt.Stderr = os.Stdout if err := gofmt.Run(); err != nil { fmt.Println(err) |