-
Notifications
You must be signed in to change notification settings - Fork 148
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
perform staticcheck in CI for better QA #310
Comments
CC @adlerhurst - I understood you did something like this for zitadel already? |
I modified the code to avoid this error as follows. // CreateAccessAndRefreshTokens implements the op.Storage interface
// it will be called for all requests able to return an access and refresh token (Authorization Code Flow, Refresh Token Request)
func (s *multiStorage) CreateAccessAndRefreshTokens(ctx context.Context, request op.TokenRequest, currentRefreshToken string) (accessTokenID string, newRefreshToken string, expiration time.Time, err error) {
storage, oidcErr := s.storageFromContext(ctx) // storage, err → storage,oidcErr
if oidcErr != nil { // err → oidcErr
return "", "", time.Time{}, err
}
return storage.CreateAccessAndRefreshTokens(ctx, request, currentRefreshToken)
} I am new to Go and do not know if this is a good solution. I would like to know if there is a better solution. |
Hi! Welcome to Go! Yes, that is a good suggestion! If you want to get started with open source, feel free to send a PR . Good luck! |
Hi! I am trying to help with this issue but some checks involves changing err return types from One example is the func (m *MockStorage) RevokeToken(arg0 context.Context, arg1, arg2, arg3 string) *oidc.Error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RevokeToken", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*oidc.Error)
return ret0
} When I run the staticcheck locally it complains: How should I proceed? |
@jkitajima do you have a public branch with the staticcheck addition, so I can have a quick look? |
Sure! You can find it here: https://github.com/jkitajima/zitadel-oidc |
When you change the interface, you need to rerun the mock generator:
However, changing the interface is a breaking change for our semver. If you intend to send a PR, be sure to open it against our |
As a maintainer I want to keep a consistent quality of code. As a reviewer I want help to prevent unused code or difficult to recognize bugs end up in the project. Staticcheck is a tool that helps with this.
By adding this tool the the test suite, pull requests with quality issues will fail to pass.
Acceptance criteria
Details
By default it is enabled by the VSCode Golang extension. As a result, it is constantly warning of some inconsistencies in the complete project. This is the status of active warnings as of writing:
On `main` branch
On `next` branch
The text was updated successfully, but these errors were encountered: