Skip to content

Commit

Permalink
Update golangci file to re-enable the field alignment check (#265)
Browse files Browse the repository at this point in the history
Signed-off-by: Arrobo, Gabriel <[email protected]>
  • Loading branch information
gab-arrobo authored Nov 22, 2024
1 parent 1d0fcf4 commit 491e4e4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
24 changes: 18 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# SPDX-FileCopyrightText: 2024 Intel Corporation
# SPDX-FileCopyrightText: 2021 Open Networking Foundation <[email protected]>
# Copyright 2019 free5GC.org
#
# SPDX-License-Identifier: Apache-2.0
#

# This file contains all available configuration options
# with their default values.
Expand Down Expand Up @@ -124,6 +126,15 @@ linters-settings:
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
gomnd:
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
checks:
- argument
- case
- condition
- operation
- return
- assign
gomodguard:
allowed:
modules: # List of allowed modules
Expand Down Expand Up @@ -151,9 +162,6 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable all analyzers
enable-all: true
disable:
- fieldalignment
disable-all: false
depguard:
list-type: blacklist
include-go-root: false
Expand Down Expand Up @@ -183,12 +191,12 @@ linters-settings:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
misspell:
#locale: US
ignore-words:
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
Expand Down Expand Up @@ -223,6 +231,7 @@ linters:
# Additional
# - lll
- godox
# - mnd
- goconst
# - gocognit
# - nestif
Expand Down Expand Up @@ -253,6 +262,9 @@ issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-dirs:
- "configapi"
- "configmodels"
exclude-files:
- "routers.go"
exclude-rules:
# Exclude some linters from running on tests files.
# Independently from option `exclude` we use default exclude patterns,
Expand Down
8 changes: 4 additions & 4 deletions backend/auth/handlers_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ func TestLogin_FailureCases(t *testing.T) {
AddAuthenticationService(router, mockJWTSecret)

testCases := []struct {
name string
dbAdapter dbadapter.DBInterface
name string
inputData string
expectedCode int
expectedBody string
expectedCode int
}{
{
name: "InvalidDataProvided",
Expand Down Expand Up @@ -227,11 +227,11 @@ func TestLogin_SuccessCases(t *testing.T) {
AddAuthenticationService(router, mockJWTSecret)

testCases := []struct {
name string
dbAdapter dbadapter.DBInterface
name string
inputData string
expectedCode int
expectedUsername string
expectedCode int
expectedRole int
}{
{
Expand Down
4 changes: 2 additions & 2 deletions backend/auth/handlers_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func TestStatus(t *testing.T) {
AddAuthenticationService(router, mockJWTSecret)

testCases := []struct {
name string
dbAdapter dbadapter.DBInterface
expectedCode int
name string
expectedBody string
expectedCode int
}{
{
name: "StatusIsInitialized",
Expand Down
2 changes: 1 addition & 1 deletion backend/auth/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
)

type jwtWebconsoleClaims struct {
jwt.StandardClaims
Username string `json:"username"`
Role int `json:"role"`
jwt.StandardClaims
}

func GenerateJWTSecret() ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion backend/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ type Info struct {

type Configuration struct {
Mongodb *Mongodb `yaml:"mongodb"`
TLS *TLS `yaml:"tls"`
RocEnd *RocEndpt `yaml:"managedByConfigPod,omitempty"` // fetch config during bootup
LteEnd []*LteEndpt `yaml:"endpoints,omitempty"` // LTE endpoints are configured and not auto-detected
TLS *TLS `yaml:"tls"`
Mode5G bool `yaml:"mode5G,omitempty"`
SdfComp bool `yaml:"spec-compliant-sdf"`
EnableAuthentication bool `yaml:"enableAuthentication,omitempty"`
Expand Down

0 comments on commit 491e4e4

Please sign in to comment.