Add golangci-lint workflow (#4999)

* fix lint workflow

* add golang lint

* close http response body
This commit is contained in:
andrew_li
2022-06-29 11:58:36 +08:00
committed by GitHub
parent f1e06466df
commit f289795312
141 changed files with 311 additions and 592 deletions

View File

@@ -17,10 +17,6 @@ limitations under the License.
package iam
import (
"context"
"fmt"
"golang.org/x/oauth2"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
"kubesphere.io/client-go/client"
@@ -53,13 +49,3 @@ func NewRestClient(user, passsword string) (*restclient.RestClient, error) {
return restclient.NewForConfig(config)
}
func getToken(host, user, password string) (*oauth2.Token, error) {
config := &oauth2.Config{
Endpoint: oauth2.Endpoint{
TokenURL: fmt.Sprintf("%s/oauth/token", host),
AuthStyle: oauth2.AuthStyleInParams,
},
}
return config.PasswordCredentialsToken(context.TODO(), user, password)
}

View File

@@ -38,10 +38,8 @@ func NewWorkspaceTemplate(name string, manager string, hosts ...string) *tenantv
clusters := []fedb1.GenericClusterReference{}
if hosts != nil {
for _, h := range hosts {
clusters = append(clusters, fedb1.GenericClusterReference{Name: h})
}
for _, h := range hosts {
clusters = append(clusters, fedb1.GenericClusterReference{Name: h})
}
return &tenantv1alpha2.WorkspaceTemplate{