Skip to content

Commit 108fdc1

Browse files
authored
chore(ci): add linter the check go code style (casdoor#991)
* feat(ci): auto format go code * fix: fix casdoor#997 * chore(ci): add go code style linter * fix: fix cmd error * chore: add `linter` of needs * chore: modiy commnet style
1 parent a741c51 commit 108fdc1

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

.github/workflows/build.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,30 @@ jobs:
5757
go build -race -ldflags "-extldflags '-static'"
5858
working-directory: ./
5959

60+
linter:
61+
name: Go-Linter
62+
runs-on: ubuntu-latest
63+
needs: [ go-tests ]
64+
steps:
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-go@v3
67+
with:
68+
go-version: '^1.16.5'
69+
70+
# gen a dummy config file
71+
- run: touch dummy.yml
72+
73+
- name: golangci-lint
74+
uses: golangci/golangci-lint-action@v3
75+
with:
76+
version: latest
77+
args: --disable-all -c dummy.yml -E=gofumpt --max-same-issues=0 --timeout 5m --modules-download-mode=mod
78+
6079
release-and-push:
6180
name: Release And Push
6281
runs-on: ubuntu-latest
6382
if: github.repository == 'casdoor/casdoor' && github.event_name == 'push'
64-
needs: [ frontend, backend ]
83+
needs: [ frontend, backend, linter ]
6584
steps:
6685
- name: Checkout
6786
uses: actions/checkout@v2

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ run:
3131
- api
3232
# skip-files:
3333
# - ".*_test\\.go$"
34-
modules-download-mode: vendor
34+
modules-download-mode: mod
3535
# all available settings of specific linters
3636
linters-settings:
3737
lll:

conf/conf_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
1415
package conf
1516

1617
import (

controllers/token.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ func (c *ApiController) TokenLogout() {
269269
// IntrospectToken
270270
// @Title IntrospectToken
271271
// @Description The introspection endpoint is an OAuth 2.0 endpoint that takes a
272-
// parameter representing an OAuth 2.0 token and returns a JSON document
273-
// representing the meta information surrounding the
274-
// token, including whether this token is currently active.
275-
// This endpoint only support Basic Authorization.
272+
// parameter representing an OAuth 2.0 token and returns a JSON document
273+
// representing the meta information surrounding the
274+
// token, including whether this token is currently active.
275+
// This endpoint only support Basic Authorization.
276+
//
276277
// @Param token formData string true "access_token's value or refresh_token's value"
277278
// @Param token_type_hint formData string true "the token type access_token or refresh_token"
278279
// @Success 200 {object} object.IntrospectionResponse The Response object

0 commit comments

Comments
 (0)