upgrading to go 1.21 (#2235)

* chore: bump go to version 1.21

update all depedencies as well

* fix linting issues based on golang 1.20 deprecations

* cleanup go depedencies

* add custom gomega matcher for option intefaces

* revert and upgrade golangci-lint to 1.55.2

* fix lint issues for v1.55.2 of golangci-lint

* fix toml loading test

* remove second runspecs call

* update go.sum

* revert testutil package
This commit is contained in:
Jan Larwig
2024-01-22 13:39:53 +00:00
committed by GitHub
parent b98f820abc
commit 5e68dad636
20 changed files with 380 additions and 591 deletions
+6 -6
View File
@@ -152,7 +152,7 @@ func (p *GitHubProvider) ValidateSession(ctx context.Context, s *sessions.Sessio
return validateToken(ctx, p, s.AccessToken, makeGitHubHeader(s.AccessToken))
}
func (p *GitHubProvider) hasOrg(ctx context.Context, s *sessions.SessionState) error {
func (p *GitHubProvider) hasOrg(s *sessions.SessionState) error {
// https://developer.github.com/v3/orgs/#list-your-organizations
var orgs []string
@@ -175,7 +175,7 @@ func (p *GitHubProvider) hasOrg(ctx context.Context, s *sessions.SessionState) e
return errors.New("user is missing required organization")
}
func (p *GitHubProvider) hasOrgAndTeam(ctx context.Context, s *sessions.SessionState) error {
func (p *GitHubProvider) hasOrgAndTeam(s *sessions.SessionState) error {
type orgTeam struct {
Org string `json:"org"`
Team string `json:"team"`
@@ -378,7 +378,7 @@ func (p *GitHubProvider) checkRestrictions(ctx context.Context, s *sessions.Sess
return err
}
if err := p.hasOrgAndTeamAccess(ctx, s); err != nil {
if err := p.hasOrgAndTeamAccess(s); err != nil {
return err
}
@@ -408,13 +408,13 @@ func (p *GitHubProvider) checkUserRestriction(ctx context.Context, s *sessions.S
return verifiedUser, nil
}
func (p *GitHubProvider) hasOrgAndTeamAccess(ctx context.Context, s *sessions.SessionState) error {
func (p *GitHubProvider) hasOrgAndTeamAccess(s *sessions.SessionState) error {
if p.Org != "" && p.Team != "" {
return p.hasOrgAndTeam(ctx, s)
return p.hasOrgAndTeam(s)
}
if p.Org != "" {
return p.hasOrg(ctx, s)
return p.hasOrg(s)
}
return nil
+2 -2
View File
@@ -167,7 +167,7 @@ func (p *GitLabProvider) getUserinfo(ctx context.Context, s *sessions.SessionSta
var userinfo gitlabUserinfo
err := requests.New(userinfoURL.String()).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+s.AccessToken).
SetHeader("Authorization", tokenTypeBearer+" "+s.AccessToken).
Do().
UnmarshalInto(&userinfo)
if err != nil {
@@ -246,7 +246,7 @@ func (p *GitLabProvider) getProjectInfo(ctx context.Context, s *sessions.Session
err := requests.New(fmt.Sprintf("%s%s", endpointURL.String(), url.QueryEscape(project))).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+s.AccessToken).
SetHeader("Authorization", tokenTypeBearer+" "+s.AccessToken).
Do().
UnmarshalInto(&projectInfo)
if err != nil {
+1 -1
View File
@@ -75,7 +75,7 @@ func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.Sessio
json, err := requests.New(profileURL).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+s.AccessToken).
SetHeader("Authorization", tokenTypeBearer+" "+s.AccessToken).
Do().
UnmarshalSimpleJSON()
if err != nil {
+1 -1
View File
@@ -182,7 +182,7 @@ func emailFromUserInfo(ctx context.Context, accessToken string, userInfoEndpoint
// query the user info endpoint for user attributes
err := requests.New(userInfoEndpoint).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+accessToken).
SetHeader("Authorization", tokenTypeBearer+" "+accessToken).
Do().
UnmarshalInto(&emailData)
if err != nil {
+1 -1
View File
@@ -45,7 +45,7 @@ func (p *NextcloudProvider) EnrichSession(ctx context.Context, s *sessions.Sessi
json, err := requests.New(profileURL).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+s.AccessToken).
SetHeader("Authorization", tokenTypeBearer+" "+s.AccessToken).
Do().
UnmarshalSimpleJSON()
if err != nil {