Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码规范:pkg lint #2667

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions bcs-services/pkg/bcs-auth-v4/audit/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package audit xxx
package audit

import (
"time"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/TencentBlueKing/bk-audit-go-sdk/bkaudit"
"github.com/google/uuid"
blog "k8s.io/klog/v2"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
"github.com/TencentBlueKing/bk-audit-go-sdk/bkaudit"
)

var auditClient *bkaudit.EventClient
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/pkg/bcs-auth-v4/cloudaccount/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package cloudaccount xxx
package cloudaccount

import (
Expand Down
3 changes: 1 addition & 2 deletions bcs-services/pkg/bcs-auth-v4/cloudaccount/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount

import (
"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
bkiam "github.com/TencentBlueKing/iam-go-sdk"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
)
Expand Down
1 change: 0 additions & 1 deletion bcs-services/pkg/bcs-auth-v4/cloudaccount/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/pkg/bcs-auth-v4/cloudaccount/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount
Expand All @@ -17,6 +16,7 @@ import (
"fmt"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"

"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount
Expand Down
3 changes: 1 addition & 2 deletions bcs-services/pkg/bcs-auth-v4/cloudaccount/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount
Expand All @@ -18,9 +17,9 @@ import (
"fmt"
"time"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
blog "k8s.io/klog/v2"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cloudaccount
Expand All @@ -17,6 +16,7 @@ import (
"testing"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"

"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/pkg/bcs-auth-v4/cluster/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package cluster xxx
package cluster

import (
Expand Down
7 changes: 5 additions & 2 deletions bcs-services/pkg/bcs-auth-v4/cluster/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster

import (
"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
bkiam "github.com/TencentBlueKing/iam-go-sdk"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
)
Expand All @@ -28,6 +27,7 @@ type ProjectClusterData struct {
}

// ClusterInstances build clusterInstances
// nolint
type ClusterInstances struct {
IsCreateCluster bool
Data []ProjectClusterData
Expand Down Expand Up @@ -66,6 +66,7 @@ func (cls ClusterInstances) BuildInstances() [][]iam.Instance {
}

// ClusterScopedInstances build clusterScopedInstances
// nolint
type ClusterScopedInstances struct {
Data []ProjectClusterData
}
Expand All @@ -91,6 +92,7 @@ func (cls ClusterScopedInstances) BuildInstances() [][]iam.Instance {
}

// ClusterApplicationAction struct for clusterApplication
// nolint
type ClusterApplicationAction struct {
IsCreateCluster bool
ActionID string
Expand Down Expand Up @@ -132,6 +134,7 @@ func BuildClusterSameInstanceApplication(isCreate bool, actionIDs []string,
}

// ClusterScopedApplicationAction struct for clusterApplication
// nolint
type ClusterScopedApplicationAction struct {
ActionID string
Data []ProjectClusterData
Expand Down
1 change: 0 additions & 1 deletion bcs-services/pkg/bcs-auth-v4/cluster/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster
Expand Down
6 changes: 5 additions & 1 deletion bcs-services/pkg/bcs-auth-v4/cluster/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster
Expand All @@ -17,6 +16,7 @@ import (
"fmt"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"

"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
)

Expand All @@ -31,6 +31,7 @@ const (
)

// ClusterResourcePath build IAMPath for cluster resource
// nolint
type ClusterResourcePath struct {
ProjectID string
ClusterCreate bool
Expand All @@ -45,6 +46,7 @@ func (rp ClusterResourcePath) BuildIAMPath() string {
}

// ClusterScopedResourcePath build IAMPath for cluster scoped resource
// nolint
type ClusterScopedResourcePath struct {
ProjectID string
}
Expand All @@ -55,6 +57,7 @@ func (rp ClusterScopedResourcePath) BuildIAMPath() string {
}

// ClusterResourceNode build cluster resourceNode
// nolint
type ClusterResourceNode struct {
IsCreateCluster bool

Expand Down Expand Up @@ -92,6 +95,7 @@ func (crn ClusterResourceNode) BuildResourceNodes() []iam.ResourceNode {
}

// ClusterScopedResourceNode build cluster scoped resourceNode
// nolint
type ClusterScopedResourceNode struct {
SystemID string
ProjectID string
Expand Down
1 change: 0 additions & 1 deletion bcs-services/pkg/bcs-auth-v4/cluster/instance_selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster
Expand Down
3 changes: 1 addition & 2 deletions bcs-services/pkg/bcs-auth-v4/cluster/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster

import (
"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
blog "k8s.io/klog/v2"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/pkg/bcs-auth-v4/cluster/permission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package cluster
Expand Down Expand Up @@ -52,6 +51,7 @@ func TestBCSClusterPerm_CanCreateCluster(t *testing.T) {
t.Fatal(err)
}

// nolint
projectID := "b37778ec757544868a01e1f01f07037f"
// projectID := "846e8195d9ca4097b354ed190acce4b1"
allow, url, _, err := cli.CanCreateCluster("liming", projectID)
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/pkg/bcs-auth-v4/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package bcsauthv4 xxx
package bcsauthv4

import (
Expand Down
13 changes: 12 additions & 1 deletion bcs-services/pkg/bcs-auth-v4/manager/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package manager xxx
package manager

import (
"fmt"

"github.com/Tencent/bk-bcs/bcs-common/pkg/auth/iam"

"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/cluster"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/namespace"
"github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth-v4/project"
Expand Down Expand Up @@ -86,6 +87,8 @@ func (c *Cluster) buildClusterOtherScope() iam.AuthorizationScope {
})
}

// NOCC:golint/unused(误报)
// nolint
func (c *Cluster) buildClusterViewScope() iam.AuthorizationScope {
return iam.BuildAuthorizationScope(cluster.SysCluster, []iam.ActionID{
cluster.ClusterView},
Expand Down Expand Up @@ -120,6 +123,8 @@ func (c *Cluster) buildClusterScopedScope() iam.AuthorizationScope {
})
}

// NOCC:golint/unused(误报)
// nolint
func (c *Cluster) buildClusterScopedViewScope() iam.AuthorizationScope {
return iam.BuildAuthorizationScope(cluster.SysCluster, []iam.ActionID{
cluster.ClusterScopedView,
Expand Down Expand Up @@ -154,6 +159,8 @@ func (c *Cluster) buildNamespaceCreateListScope() iam.AuthorizationScope {
})
}

// NOCC:golint/unused(误报)
// nolint
func (c *Cluster) buildNamespaceListScope() iam.AuthorizationScope {
return iam.BuildAuthorizationScope(cluster.SysCluster, []iam.ActionID{
namespace.NameSpaceList,
Expand Down Expand Up @@ -188,6 +195,8 @@ func (c *Cluster) buildNamespaceOtherScope() iam.AuthorizationScope {
})
}

// NOCC:golint/unused(误报)
// nolint
func (c *Cluster) buildNamespaceViewScope() iam.AuthorizationScope {
return iam.BuildAuthorizationScope(namespace.SysNamespace, []iam.ActionID{
namespace.NameSpaceView,
Expand Down Expand Up @@ -223,6 +232,8 @@ func (c *Cluster) buildNamespaceScopedScope() iam.AuthorizationScope {
})
}

// NOCC:golint/unused(误报)
// nolint
func (c *Cluster) buildNamespaceScopedViewScope() iam.AuthorizationScope {
return iam.BuildAuthorizationScope(namespace.SysNamespace, []iam.ActionID{
namespace.NameSpaceScopedView,
Expand Down
Loading
Loading