Skip to content

Commit b073175

Browse files
authored
update boilerplate header and apply go fmt (sigstore#275)
* update boilerplate header and apply go fmt Signed-off-by: Carlos Panato <ctadeu@gmail.com> * lints: fix golangci-lint issues Signed-off-by: Carlos Panato <ctadeu@gmail.com> * updated based on feedback Signed-off-by: Carlos Panato <ctadeu@gmail.com>
1 parent fb878e4 commit b073175

File tree

146 files changed

+1392
-1041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1392
-1041
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
217
version: 2
318
updates:
4-
- package-ecosystem: "gomod"
19+
- package-ecosystem: "gomod"
520
directory: "/" # Location of package manifests
621
schedule:
722
interval: "daily"

.github/workflows/codeql-analysis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
2-
name: "CodeQL"
17+
name: CodeQL
318
on:
419
push:
520
branches: [ main ]

.github/workflows/main.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,55 @@
1-
# This is a basic workflow to help you get started with Actions
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
215

316
name: CI
417

5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the main branch
718
on:
819
push:
920
branches: [ main ]
1021
pull_request:
1122
branches: [ main ]
1223

13-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1424
jobs:
1525
build:
16-
# The type of runner that the job will run on
1726
runs-on: ubuntu-20.04
1827

19-
# Steps represent a sequence of tasks that will be executed as part of the job
2028
steps:
21-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2229
- uses: actions/checkout@v2
23-
# Extract version of Go to use
2430
- name: Extract version of Go to use
2531
run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | sed -r 's/^.*://g'| uniq)" >> $GITHUB_ENV
26-
# Setup Go
2732
- uses: actions/setup-go@v2
2833
with:
2934
go-version: ${{ env.GOVERSION }}
30-
# Download go-swagger
3135
- name: download go-swagger
3236
run : go install github.com/go-swagger/go-swagger/cmd/swagger@v0.27.0
3337
- name: Validate OpenAPI with Swagger
3438
run: swagger validate openapi.yaml
35-
# Make it
3639
- name: Build
3740
run: make -C $GITHUB_WORKSPACE all
38-
# Lint it
39-
- name: golangci-lint
40-
uses: golangci/golangci-lint-action@v2.5.2
41-
with:
42-
version: v1.37.1
43-
# Test It
4441
- name: Test
4542
run: go test -v ./...
46-
# Gosec It
47-
- name: Run Gosec Security Scanner
48-
uses: securego/gosec@v2.7.0
49-
env:
50-
GOROOT: ""
51-
with:
52-
args: ./...
5343
- name: Ensure no files were modified as a result of the build
5444
run: git update-index --refresh && git diff-index --quiet HEAD -- || git diff --exit-code
45+
5546
e2e:
56-
# The type of runner that the job will run on
57-
runs-on: ubuntu-20.04
47+
runs-on: ubuntu-20.04
5848
needs: build
59-
# Steps represent a sequence of tasks that will be executed as part of the job
49+
6050
steps:
6151
- name: download minisign
6252
run: sudo add-apt-repository ppa:dysfunctionalprogramming/minisign && sudo apt-get update && sudo apt-get install minisign
63-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6453
- uses: actions/checkout@v2
6554
- name: Docker Build
6655
run: docker-compose build

.github/workflows/verify.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: Verify
17+
18+
on: [push, pull_request]
19+
20+
jobs:
21+
license-check:
22+
name: license boilerplate check
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-go@v2
27+
with:
28+
go-version: '1.16'
29+
- name: Install addlicense
30+
run: go install github.com/google/addlicense@latest
31+
- name: Check license headers
32+
run: |
33+
set -e
34+
addlicense -l apache -c 'The Sigstore Authors' -v *
35+
git diff --exit-code
36+
37+
golangci:
38+
name: lint
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: deps
43+
run: sudo apt-get update && sudo apt-get install -yq libpcsclite-dev
44+
- name: golangci-lint
45+
uses: golangci/golangci-lint-action@v2
46+
timeout-minutes: 5
47+
with:
48+
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
49+
version: v1.39

.golangci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
linters:
17+
enable:
18+
- deadcode
19+
- errcheck
20+
- gofmt
21+
- goimports
22+
- gosec
23+
- gocritic
24+
- golint
25+
- misspell
26+
output:
27+
uniq-by-line: false
28+
issues:
29+
exclude-rules:
30+
- path: _test\.go
31+
linters:
32+
- errcheck
33+
- gosec
34+
max-issues-per-linter: 0
35+
max-same-issues: 0
36+
run:
37+
issues-exit-code: 1
38+
timeout: 10m

COPYRIGHT.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/*
2-
Copyright The Rekor Authors.
1+
2+
Copyright 2021 The Sigstore Authors.
33

44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -12,4 +12,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15-
*/

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
FROM golang:1.16.3 AS builder
217
ENV APP_ROOT=/opt/app-root
318
ENV GOPATH=$APP_ROOT

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
#
2+
# Copyright 2021 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
.PHONY: all test clean clean-gen lint gosec
217

318
all: rekor-cli rekor-server

cmd/rekor-cli/app/format/wrap.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//
2+
// Copyright 2021 The Sigstore Authors.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
116
package format
217

318
import (
@@ -9,11 +24,11 @@ import (
924
"github.com/spf13/viper"
1025
)
1126

12-
type cobraCmd func(cmd *cobra.Command, args []string)
27+
type CobraCmd func(cmd *cobra.Command, args []string)
1328

1429
type formatCmd func(args []string) (interface{}, error)
1530

16-
func WrapCmd(f formatCmd) cobraCmd {
31+
func WrapCmd(f formatCmd) CobraCmd {
1732
return func(cmd *cobra.Command, args []string) {
1833
obj, err := f(args)
1934
if err != nil {
@@ -27,15 +42,15 @@ func WrapCmd(f formatCmd) cobraCmd {
2742
if s, ok := obj.(fmt.Stringer); ok {
2843
fmt.Print(s.String())
2944
} else {
30-
fmt.Println(toJson(s))
45+
fmt.Println(toJSON(s))
3146
}
3247
case "json":
33-
fmt.Println(toJson(obj))
48+
fmt.Println(toJSON(obj))
3449
}
3550
}
3651
}
3752

38-
func toJson(i interface{}) string {
53+
func toJSON(i interface{}) string {
3954
b, err := json.Marshal(i)
4055
if err != nil {
4156
log.Fatal(err)

cmd/rekor-cli/app/get.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
/*
2-
Copyright © 2020 Bob Callaway <bcallawa@redhat.com>
1+
//
2+
// Copyright 2021 The Sigstore Authors.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
315

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1616
package app
1717

1818
import (
@@ -25,14 +25,14 @@ import (
2525
"time"
2626

2727
"github.com/go-openapi/runtime"
28+
"github.com/spf13/cobra"
29+
"github.com/spf13/viper"
30+
2831
"github.com/sigstore/rekor/cmd/rekor-cli/app/format"
2932
"github.com/sigstore/rekor/pkg/generated/client/entries"
3033
"github.com/sigstore/rekor/pkg/generated/models"
3134
"github.com/sigstore/rekor/pkg/log"
3235
"github.com/sigstore/rekor/pkg/types"
33-
34-
"github.com/spf13/cobra"
35-
"github.com/spf13/viper"
3636
)
3737

3838
type getCmdOutput struct {

0 commit comments

Comments
 (0)