Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions github/enterprise_manage_ghes_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
}

// LicenseStatus is a struct to hold the response from the License API.
// SupportKey is documented as string but is actual a bool.
// TODO: Remove comment after github updates schema documentation

Check failure on line 74 in github/enterprise_manage_ghes_config.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Comment should end in a period (godot)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s4mur4i - please remove these two lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline version was failing lint, so I moved it to header par, similar to licensestatus.
As I see lint output that part doesnt fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have plenty of inline comments for fields - they all passed linting. E.g.,

go-github/github/billing.go

Lines 131 to 132 in 0eacd34

// Organization name is only used for organization-level reports.
OrganizationName *string `json:"organizationName,omitempty"`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it back, Can linter be run again please.

type LicenseStatus struct {
AdvancedSecurityEnabled *bool `json:"advancedSecurityEnabled,omitempty"`
AdvancedSecuritySeats *int `json:"advancedSecuritySeats,omitempty"`
Expand All @@ -87,7 +89,7 @@
ReferenceNumber *string `json:"referenceNumber,omitempty"`
Seats *int `json:"seats,omitempty"`
SSHAllowed *bool `json:"sshAllowed,omitempty"`
SupportKey *string `json:"supportKey,omitempty"`
SupportKey *bool `json:"supportKey,omitempty"`
Comment thread
s4mur4i marked this conversation as resolved.
Outdated
UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"`
}

Expand Down Expand Up @@ -353,15 +355,17 @@
//
// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information
//
//meta:operation GET /manage/v1/config/license

Check failure on line 358 in github/enterprise_manage_ghes_config.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not properly formatted (gci)
func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Response, error) {
// Current Docs shouw incorrect return type. They list as [{...}] but actual is {...}
// TODO: Remove comment after github updates schema documentation
Comment thread
s4mur4i marked this conversation as resolved.
Outdated
func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) {
Comment thread
s4mur4i marked this conversation as resolved.
u := "manage/v1/config/license"
req, err := s.client.NewRequest(ctx, "GET", u, nil)
if err != nil {
return nil, nil, err
}

var licenseStatus []*LicenseStatus
var licenseStatus *LicenseStatus
resp, err := s.client.Do(req, &licenseStatus)
if err != nil {
return nil, resp, err
Expand Down
12 changes: 6 additions & 6 deletions github/enterprise_manage_ghes_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func TestEnterpriseService_License(t *testing.T) {

mux.HandleFunc("/manage/v1/config/license", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
fmt.Fprint(w, `[{
fmt.Fprint(w, `{
"advancedSecurityEnabled": true,
"advancedSecuritySeats": 0,
"clusterSupport": false,
Expand All @@ -424,9 +424,9 @@ func TestEnterpriseService_License(t *testing.T) {
"referenceNumber": "32a145",
"seats": 0,
"sshAllowed": true,
"supportKey": "",
"supportKey": true,
"unlimitedSeating": true
}]`)
}`)
})

ctx := t.Context()
Expand All @@ -435,7 +435,7 @@ func TestEnterpriseService_License(t *testing.T) {
t.Errorf("Enterprise.License returned error: %v", err)
}

want := []*LicenseStatus{{
want := &LicenseStatus{
AdvancedSecurityEnabled: Ptr(true),
AdvancedSecuritySeats: Ptr(0),
ClusterSupport: Ptr(false),
Expand All @@ -452,9 +452,9 @@ func TestEnterpriseService_License(t *testing.T) {
ReferenceNumber: Ptr("32a145"),
Seats: Ptr(0),
SSHAllowed: Ptr(true),
SupportKey: Ptr(""),
SupportKey: Ptr(true),
UnlimitedSeating: Ptr(true),
}}
}
if diff := cmp.Diff(want, license); diff != "" {
t.Errorf("diff mismatch (-want +got):\n%v", diff)
}
Expand Down
4 changes: 2 additions & 2 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading