From 84ee81d04c4b3ac2d84db7ac9a2b21bf2b629447 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Tue, 7 Oct 2025 13:28:52 +0300 Subject: [PATCH] fix: Correct body in `EnterpriseService.InitialConfig` --- .golangci.yml | 1 + github/enterprise_manage_ghes_config.go | 10 +++++----- github/timestamp_test.go | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index fb4b385019d..673b9cd7cea 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ linters: - gosec - intrange - misspell + - musttag - nakedret - paralleltest - perfsprint diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index ded48ddc704..b13d035e256 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -63,10 +63,10 @@ type ConfigApplyEventsNodeEvent struct { SpanDepth *int `json:"span_depth,omitempty"` } -// InitialConfigOptions is a struct to hold the options for the InitialConfig API. +// InitialConfigOptions represents the payload for initializing instance configuration. type InitialConfigOptions struct { - License string `url:"license"` - Password string `url:"password"` + License string `json:"license"` + Password string `json:"password"` } // LicenseStatus is a struct to hold the response from the License API. @@ -336,12 +336,12 @@ func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigA func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password string) (*Response, error) { u := "manage/v1/config/init" - opts := &InitialConfigOptions{ + payload := &InitialConfigOptions{ License: license, Password: password, } - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest("POST", u, payload) if err != nil { return nil, err } diff --git a/github/timestamp_test.go b/github/timestamp_test.go index 857cc3e7be0..e8b5e7f08ef 100644 --- a/github/timestamp_test.go +++ b/github/timestamp_test.go @@ -111,8 +111,8 @@ func TestTimestamp_MarshalReflexivity(t *testing.T) { } type WrappedTimestamp struct { - A int - Time Timestamp + A int `json:"A"` + Time Timestamp `json:"Time"` } func TestWrappedTimestamp_Marshal(t *testing.T) {