diff --git a/netbox/generate_basic_tests.go b/netbox/generate_basic_tests.go index 01d83e7dd6d9cfbfd85a60dd01e955e0d9b9597a..446e712de77ed98197e635b791e89ed9e256a17e 100644 --- a/netbox/generate_basic_tests.go +++ b/netbox/generate_basic_tests.go @@ -64,7 +64,6 @@ func main() { // go fmt res, err := format.Source(b.Bytes()) if err != nil { - b.WriteTo(os.Stderr) log.Fatal(err) } @@ -73,7 +72,10 @@ func main() { log.Fatal(err) } defer f.Close() - f.Write(res) + _, err = f.Write(res) + if err != nil { + log.Fatal(err) + } } var functionsTemplate = template.Must(template.New("").Parse(`// Copyright 2017 The go-netbox Authors. @@ -90,9 +92,7 @@ var functionsTemplate = template.Must(template.New("").Parse(`// Copyright 2017 // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// {{ .Timestamp }} +// Code generated by generate_functions.go. DO NOT EDIT. package netbox diff --git a/netbox/generate_functions.go b/netbox/generate_functions.go index de6f33a2898d1e24e0d37bdffa19c38485a45481..9411f8c3b8c218d65d1319d8d8bed90f6d907839 100644 --- a/netbox/generate_functions.go +++ b/netbox/generate_functions.go @@ -63,7 +63,6 @@ func main() { // go fmt res, err := format.Source(b.Bytes()) if err != nil { - b.WriteTo(os.Stderr) log.Fatal(err) } @@ -72,7 +71,10 @@ func main() { log.Fatal(err) } defer f.Close() - f.Write(res) + _, err = f.Write(res) + if err != nil { + log.Fatal(err) + } } var functionsTemplate = template.Must(template.New("").Parse(`// Copyright 2017 The go-netbox Authors. @@ -89,9 +91,7 @@ var functionsTemplate = template.Must(template.New("").Parse(`// Copyright 2017 // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// {{ .Timestamp }} +// Code generated by generate_functions.go. DO NOT EDIT. package netbox @@ -170,14 +170,15 @@ func (s *{{ .ServiceName }}) Update(data *{{ .TypeName }}) (int, error) { http.MethodPatch, fmt.Sprintf("api/{{ .Endpoint }}/{{ .Service }}/%d/", data.ID), nil, - data) + data, + ) if err != nil { return 0, err } // g is just used to verify correct api result. // data is not changed, because the g is not the full representation that one would - // get with Get. But if the response was unmarshaled into {{ .UpdateTypeName }} corretcly, + // get with Get. But if the response was unmarshaled into {{ .UpdateTypeName }} correctly, // everything went fine, and we do not need to update data. g := new({{ .UpdateTypeName }}) err = s.c.Do(req, g) @@ -192,7 +193,8 @@ func (s *{{ .ServiceName }}) Delete(data *{{ .TypeName }}) error { req, err := s.c.NewRequest( http.MethodDelete, fmt.Sprintf("api/{{ .Endpoint }}/{{ .Service }}/%d/", data.ID), - nil) + nil, + ) if err != nil { return err } diff --git a/netbox/tenancy.go b/netbox/tenancy.go index e88eb630eb205d98e5e8e83f36eef60f3e01337c..b44124f2a8a1211831becba9475d548d1cb2e81f 100644 --- a/netbox/tenancy.go +++ b/netbox/tenancy.go @@ -21,7 +21,7 @@ type TenancyService struct { Tenants *TenantsService } -// NewTenancyService returns a TenancyService initialized with all sub-service. +// NewTenancyService returns a TenancyService initialized with all sub-services. func NewTenancyService(client *Client) *TenancyService { return &TenancyService{ c: client, diff --git a/netbox/tenancy_tenant-groups.go b/netbox/tenancy_tenant-groups.go index a774faee21ee17c26adfac13841d5384a5fd7cca..8e1a62ad2a14fbf0aeb041c8f16596f2318da7b4 100644 --- a/netbox/tenancy_tenant-groups.go +++ b/netbox/tenancy_tenant-groups.go @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// 2017-05-18 14:20:17.056969293 +0200 CEST +// Code generated by generate_functions.go. DO NOT EDIT. package netbox @@ -87,14 +85,15 @@ func (s *TenantGroupsService) Update(data *TenantGroup) (int, error) { http.MethodPatch, fmt.Sprintf("api/tenancy/tenant-groups/%d/", data.ID), nil, - data) + data, + ) if err != nil { return 0, err } // g is just used to verify correct api result. // data is not changed, because the g is not the full representation that one would - // get with Get. But if the response was unmarshaled into TenantGroup corretcly, + // get with Get. But if the response was unmarshaled into TenantGroup correctly, // everything went fine, and we do not need to update data. g := new(TenantGroup) err = s.c.Do(req, g) @@ -109,7 +108,8 @@ func (s *TenantGroupsService) Delete(data *TenantGroup) error { req, err := s.c.NewRequest( http.MethodDelete, fmt.Sprintf("api/tenancy/tenant-groups/%d/", data.ID), - nil) + nil, + ) if err != nil { return err } diff --git a/netbox/tenancy_tenant-groups_basic_test.go b/netbox/tenancy_tenant-groups_basic_test.go index b96098df1a330a5aac4e5f0ee786c550970ded30..2e3322e38d8a969f7887bec47ef8ac5ee61ed8c7 100644 --- a/netbox/tenancy_tenant-groups_basic_test.go +++ b/netbox/tenancy_tenant-groups_basic_test.go @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// 2017-05-18 14:20:17.307177904 +0200 CEST +// Code generated by generate_functions.go. DO NOT EDIT. package netbox diff --git a/netbox/tenancy_tenants.go b/netbox/tenancy_tenants.go index 5b751de150227ee0515c1ce56a539808b79c7c69..0c265acf8db817f25fa03143c90327f1bdfa3def 100644 --- a/netbox/tenancy_tenants.go +++ b/netbox/tenancy_tenants.go @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// 2017-05-18 14:20:17.557582817 +0200 CEST +// Code generated by generate_functions.go. DO NOT EDIT. package netbox @@ -87,14 +85,15 @@ func (s *TenantsService) Update(data *Tenant) (int, error) { http.MethodPatch, fmt.Sprintf("api/tenancy/tenants/%d/", data.ID), nil, - data) + data, + ) if err != nil { return 0, err } // g is just used to verify correct api result. // data is not changed, because the g is not the full representation that one would - // get with Get. But if the response was unmarshaled into updateTenant corretcly, + // get with Get. But if the response was unmarshaled into updateTenant correctly, // everything went fine, and we do not need to update data. g := new(updateTenant) err = s.c.Do(req, g) @@ -109,7 +108,8 @@ func (s *TenantsService) Delete(data *Tenant) error { req, err := s.c.NewRequest( http.MethodDelete, fmt.Sprintf("api/tenancy/tenants/%d/", data.ID), - nil) + nil, + ) if err != nil { return err } diff --git a/netbox/tenancy_tenants_basic_test.go b/netbox/tenancy_tenants_basic_test.go index 6586429ac3975d4e5b492bad9358c52b6d331b4e..e26756f54541e2f987bbaf66b60977033db5b968 100644 --- a/netbox/tenancy_tenants_basic_test.go +++ b/netbox/tenancy_tenants_basic_test.go @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by robots at -// 2017-05-18 14:20:17.805444662 +0200 CEST +// Code generated by generate_functions.go. DO NOT EDIT. package netbox