Skip to content
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

deps: update to golang v1.21 #96

Merged
merged 20 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
interval: "weekly"
groups:
all:
patterns:
- "*"

- package-ecosystem: "github-actions"
# Maintain dependencies for Golang
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

interval: "monthly"
groups:
all:
patterns:
- "*"
2 changes: 0 additions & 2 deletions .github/linters/.dockerfilelintrc

This file was deleted.

1 change: 0 additions & 1 deletion .github/linters/.golangci.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -71,7 +71,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -85,7 +85,7 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3

nancy:
name: Sonatype Nancy
Expand All @@ -105,9 +105,9 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Go 1.x
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ^1.16
go-version: ^1.21

- name: Write Go module list
run: go list -json -m all > go.list
Expand Down
118 changes: 29 additions & 89 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,117 +2,57 @@ name: Linter

on:
push:
branches:
- '**'
branches: [ master ]
pull_request:
branches:
- '**'
types: [ opened, synchronize, reopened ]
branches: [ master ]

permissions: write-all
permissions:
contents: read

jobs:
lint:
golangci:
runs-on: ubuntu-latest
steps:
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@v4
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe #v4.1.0
with:
go-version-file: go.mod
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc #v3.7.0
with:
fetch-depth: 0
version: latest
only-new-issues: true

- name: Check out code base
if: github.event_name == 'pull_request'
super-linter-markdown:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Lint Code Base
uses: github/super-linter@v4
- name: Super-linter
uses: super-linter/super-linter@v5.7.2
env:
DEFAULT_BRANCH: 'main'
VALIDATE_MARKDOWN: true
VALIDATE_DOCKERFILE: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

go:
runs-on: ubuntu-latest
steps:
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Golang linter
uses: golangci/[email protected]

shellcheck:
reviewdog-misspell:
runs-on: ubuntu-latest
steps:
- name: Check out code base
if: github.event_name == 'push'
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run shellcheck with reviewdog
uses: reviewdog/action-shellcheck@v1

misspell:
runs-on: ubuntu-latest
steps:
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run misspell with reviewdog
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
locale: "US"

alex:
reviewdog-alex:
runs-on: ubuntu-latest
steps:
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run alex with reviewdog
uses: reviewdog/action-alex@v1
- uses: actions/checkout@v4
- uses: reviewdog/action-alex@v1

goreportcard:
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Mark stale issues and pull requests
uses: actions/stale@v4
uses: actions/stale@v9
with:
repo-token: ${{ github.token }}
exempt-issue-labels: "enhancement,question,help wanted,bug"
Expand Down
76 changes: 0 additions & 76 deletions .golangci.yml

This file was deleted.

5 changes: 2 additions & 3 deletions archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
nurl "net/url"
"os"
Expand Down Expand Up @@ -136,7 +135,7 @@ func (arc *Archiver) Archive(ctx context.Context, req Request) ([]byte, string,
// Check the type of the downloaded file.
// If it's not HTML, just return it as it is.
if !strings.HasPrefix(contentType, "text/html") {
content, err := ioutil.ReadAll(req.Input)
content, err := io.ReadAll(req.Input)
return content, contentType, err
}

Expand Down Expand Up @@ -219,7 +218,7 @@ func (arc *Archiver) transform(uri string, content []byte, contentType string) s
path = filepath.Join(arc.WrapDirectory, name)
}

if err := ioutil.WriteFile(path, content, 0600); err != nil {
if err := os.WriteFile(path, content, 0600); err != nil {
// Fallback to creating data URL
if contentType == "" {
contentType = http.DetectContentType(content)
Expand Down
37 changes: 21 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
module github.com/go-shiori/obelisk

go 1.14
go 1.21

require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.2
github.com/go-shiori/dom v0.0.0-20210627111528-4e4722cd0d65
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
github.com/cenkalti/backoff/v4 v4.2.1
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c
github.com/kennygrant/sanitize v1.2.4
github.com/kr/pretty v0.2.0 // indirect
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.0 // indirect
github.com/tdewolff/parse/v2 v2.5.27
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/tdewolff/parse/v2 v2.7.7
golang.org/x/net v0.19.0
golang.org/x/sync v0.5.0
)

require (
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading