Skip to content

Commit 966951c

Browse files
authored
Bump up to go 1.23 and clean up Docker images (#188)
1 parent 69f34ab commit 966951c

File tree

20 files changed

+139
-45
lines changed

20 files changed

+139
-45
lines changed

.github/workflows/license-eye-check.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
name: Build LicenseEye
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232

3333
- uses: actions/setup-go@v5
3434
with:
35-
go-version: 1.18
35+
go-version: 1.23
3636

3737
- name: Lint Codes
3838
run: make lint

.golangci.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ linters-settings:
3333
min-len: 2
3434
min-occurrences: 2
3535
depguard:
36-
list-type: blacklist
37-
include-go-root: true
38-
packages-with-error-messages:
39-
fmt: "logging is allowed only by logutils.Log"
36+
rules:
37+
main:
38+
deny:
39+
- pkg: "fmt"
40+
desc: "logging is allowed only by logutils.Log"
4041
misspell:
4142
locale: US
4243
ignore-words:
@@ -94,11 +95,9 @@ linters-settings:
9495
linters:
9596
enable:
9697
- bodyclose
97-
- deadcode
98-
- depguard
98+
- errcheck
9999
- dogsled
100100
- dupl
101-
- errcheck
102101
- funlen
103102
- goconst
104103
- gocritic
@@ -114,16 +113,13 @@ linters:
114113
- misspell
115114
- nakedret
116115
- staticcheck
117-
- structcheck
118-
- stylecheck
119116
- typecheck
120117
- unconvert
121118
- unparam
122119
- unused
123-
- varcheck
124120
- whitespace
125121

126122
service:
127-
golangci-lint-version: 1.20.x
123+
golangci-lint-version: 1.63.4
128124
prepare:
129125
- echo "here I can run custom commands, but no preparation needed for this repo"

Dockerfile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
# TODO: minimize the docker image size, now 524MB !!!
19-
20-
FROM golang:1.18-alpine AS build
18+
FROM golang:1.23-alpine AS build
2119

2220
WORKDIR /license-eye
2321

@@ -29,12 +27,6 @@ FROM alpine:3 AS bin
2927

3028
COPY --from=build /license-eye/bin/linux/license-eye /bin/license-eye
3129

32-
# Go
33-
COPY --from=build /usr/local/go/bin/go /usr/local/go/bin/go
34-
ENV PATH="/usr/local/go/bin:$PATH"
35-
RUN apk add --no-cache bash gcc musl-dev npm cargo
36-
# Go
37-
3830
WORKDIR /github/workspace/
3931

4032
ENTRYPOINT ["/bin/license-eye"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RELEASE_SRC = skywalking-$(PROJECT)-$(VERSION)-src
4343
all: clean lint license test build
4444

4545
$(GO_LINT):
46-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.49.0
46+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.63.4
4747

4848
.PHONY: lint
4949
lint: $(GO_LINT)
@@ -74,7 +74,7 @@ build: windows linux darwin
7474

7575
.PHONY: docker
7676
docker:
77-
docker build . -t $(HUB)/$(PROJECT):$(VERSION) -t $(HUB)/$(PROJECT):latest
77+
docker build --no-cache . -t $(HUB)/$(PROJECT):$(VERSION) -t $(HUB)/$(PROJECT):latest
7878

7979
.PHONY: docker-push
8080
docker-push:

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header ch
109109
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
110110
```
111111

112+
#### Using Docker for License Dependency Checks
113+
114+
To check dependencies' licenses in Docker, you'll need the appropriate language runtime and package managers in your environment. The base Docker image only includes the license-eye binary. To check dependencies, you can build a custom Docker image with your required language tools:
115+
116+
```dockerfile
117+
FROM apache/skywalking-eyes:latest
118+
119+
# Install the tools you need
120+
```
121+
122+
See the [examples directory](examples/) for more detailed examples and Dockerfiles for different languages.
123+
112124
### Docker Image from the latest codes
113125

114126
For users and developers who want to help to test the latest codes on main branch, we publish a Docker image to the GitHub

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ inputs:
4444
runs:
4545
using: "composite"
4646
steps:
47-
- name: Set up Go 1.18
47+
- name: Set up Go
4848
uses: actions/setup-go@v5
4949
with:
50-
go-version: 1.18
50+
go-version: 1.23
5151
cache-dependency-path: ${{ github.action_path }}/go.sum
5252
- shell: bash
5353
run: make -C $GITHUB_ACTION_PATH install

commands/deps_check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var DepsCheckCommand = &cobra.Command{
3939
Use: "check",
4040
Aliases: []string{"c"},
4141
Long: "resolves and check license compatibility in all dependencies of a module and their transitive dependencies",
42-
RunE: func(cmd *cobra.Command, args []string) error {
42+
RunE: func(_ *cobra.Command, _ []string) error {
4343
var errors []error
4444
configDeps := Config.Dependencies()
4545
for _, header := range Config.Headers() {

commands/deps_resolve.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ import (
3333
"github.com/apache/skywalking-eyes/pkg/deps"
3434
)
3535

36-
var outDir string
37-
var licensePath string
38-
var summaryTplPath string
39-
var summaryTpl *template.Template
36+
var (
37+
outDir string
38+
licensePath string
39+
summaryTplPath string
40+
summaryTpl *template.Template
41+
)
4042

4143
func init() {
4244
DepsResolveCommand.PersistentFlags().StringVarP(&outDir, "output", "o", "",
@@ -54,7 +56,7 @@ var DepsResolveCommand = &cobra.Command{
5456
Use: "resolve",
5557
Aliases: []string{"r"},
5658
Long: "resolves all dependencies of a module and their transitive dependencies",
57-
PreRunE: func(cmd *cobra.Command, args []string) error {
59+
PreRunE: func(_ *cobra.Command, _ []string) error {
5860
if outDir != "" {
5961
absPath, err := filepath.Abs(outDir)
6062
if err != nil {
@@ -97,7 +99,7 @@ var DepsResolveCommand = &cobra.Command{
9799
}
98100
return nil
99101
},
100-
RunE: func(cmd *cobra.Command, args []string) error {
102+
RunE: func(_ *cobra.Command, _ []string) error {
101103
report := deps.Report{}
102104

103105
configDeps := Config.Dependencies()

commands/header_check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var CheckCommand = &cobra.Command{
3232
Use: "check",
3333
Aliases: []string{"c"},
3434
Long: "check command walks the specified paths recursively and checks if the specified files have the license header in the config file.",
35-
RunE: func(cmd *cobra.Command, args []string) error {
35+
RunE: func(_ *cobra.Command, args []string) error {
3636
hasErrors := false
3737
for _, h := range Config.Headers() {
3838
var result header.Result

commands/header_fix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var FixCommand = &cobra.Command{
3131
Use: "fix",
3232
Aliases: []string{"f"},
3333
Long: "fix command walks the specified paths recursively and fix the license header if the specified files don't have the license header.",
34-
RunE: func(cmd *cobra.Command, args []string) error {
34+
RunE: func(_ *cobra.Command, args []string) error {
3535
var errors []string
3636
for _, h := range Config.Headers() {
3737
var result header.Result

0 commit comments

Comments
 (0)