Skip to content

Commit

Permalink
Bump go version to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Aug 14, 2023
1 parent 092bc0f commit c877236
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
os: [ubuntu-latest, macOS-latest]
name: Go ${{ matrix.go }} in ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Environment
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.54.1
only-new-issues: true
- name: Test
env:
Expand Down
8 changes: 4 additions & 4 deletions extractors/bilibili/bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package bilibili
import (
"encoding/json"
"fmt"
"slices"
"sort"
"strconv"
"strings"
"time"

"github.com/iawia002/lia/array"
"github.com/pkg/errors"

"github.com/iawia002/lux/extractors"
Expand Down Expand Up @@ -158,7 +158,7 @@ func extractBangumi(url, html string, extractOption extractors.Options) ([]*extr
wgp := utils.NewWaitGroupPool(extractOption.ThreadNumber)
dataIndex := 0
for index, u := range data.EpList {
if !array.ItemInArray(index+1, needDownloadItems) {
if !slices.Contains(needDownloadItems, index+1) {
continue
}
wgp.Add()
Expand Down Expand Up @@ -259,7 +259,7 @@ func multiEpisodeDownload(url, html string, extractOption extractors.Options, pa
wgp := utils.NewWaitGroupPool(extractOption.ThreadNumber)
dataIndex := 0
for index, u := range pageData.Sections[0].Episodes {
if !array.ItemInArray(index+1, needDownloadItems) {
if !slices.Contains(needDownloadItems, index+1) {
continue
}
wgp.Add()
Expand Down Expand Up @@ -288,7 +288,7 @@ func multiPageDownload(url, html string, extractOption extractors.Options, pageD
wgp := utils.NewWaitGroupPool(extractOption.ThreadNumber)
dataIndex := 0
for index, u := range pageData.VideoData.Pages {
if !array.ItemInArray(index+1, needDownloadItems) {
if !slices.Contains(needDownloadItems, index+1) {
continue
}
wgp.Add()
Expand Down
4 changes: 2 additions & 2 deletions extractors/qq/qq.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package qq
import (
"encoding/json"
"fmt"
"slices"
"strconv"
"strings"

"github.com/iawia002/lia/array"
"github.com/pkg/errors"

"github.com/iawia002/lux/extractors"
Expand Down Expand Up @@ -85,7 +85,7 @@ func genStreams(vid, cdn string, data qqVideoInfo) (map[string]*extractors.Strea
for _, fi := range data.Fl.Fi {
var fmtIDPrefix string
var fns []string
if array.ItemInArray(fi.Name, []string{"shd", "fhd"}) {
if slices.Contains([]string{"shd", "fhd"}, fi.Name) {
fmtIDPrefix = "p"
fmtIDName := fmt.Sprintf("%s%d", fmtIDPrefix, fi.ID%10000)
fns = []string{strings.Split(data.Vl.Vi[0].Fn, ".")[0], fmtIDName, "mp4"}
Expand Down
4 changes: 2 additions & 2 deletions extractors/youtube/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package youtube
import (
"fmt"
"net/http"
"slices"
"strconv"

"github.com/iawia002/lia/array"
"github.com/kkdai/youtube/v2"
"github.com/pkg/errors"

Expand Down Expand Up @@ -59,7 +59,7 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
wgp := utils.NewWaitGroupPool(option.ThreadNumber)
dataIndex := 0
for index, videoEntry := range playlist.Videos {
if !array.ItemInArray(index+1, needDownloadItems) {
if !slices.Contains(needDownloadItems, index+1) {
continue
}

Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
module github.com/iawia002/lux

go 1.20
go 1.21

require (
github.com/MercuryEngineering/CookieMonster v0.0.0-20180304172713-1584578b3403
github.com/PuerkitoBio/goquery v1.8.0
github.com/cheggaaa/pb/v3 v3.0.8
github.com/dop251/goja v0.0.0-20230304130813-e2f543bf4b4c
github.com/fatih/color v1.13.0
github.com/iawia002/lia v0.1.0
github.com/itchyny/gojq v0.12.7
github.com/json-iterator/go v1.1.12
github.com/kkdai/youtube/v2 v2.7.18
Expand Down Expand Up @@ -37,7 +36,6 @@ require (
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/exp v0.0.0-20220518171630-0b5c67f07fdf // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEq
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/cheggaaa/pb/v3 v3.0.8 h1:bC8oemdChbke2FHIIGy9mn4DPJ2caZYQnfbRqwmdCoA=
github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
Expand Down Expand Up @@ -41,8 +42,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U=
github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg=
github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/iawia002/lia v0.1.0 h1:IzgR5pnOEt3bABB3TtcK5UCXkzcuc7+3GYxT0cVpYfU=
github.com/iawia002/lia v0.1.0/go.mod h1:Jxu7iNh5z17HWuLedH3jwh09aa5SO3g2BI2Ct87aXpY=
github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ=
github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw=
github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU=
Expand Down Expand Up @@ -94,13 +93,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/urfave/cli/v2 v2.6.0 h1:yj2Drkflh8X/zUrkWlWlUjZYHyWN7WMmpVxyxXIUyv8=
github.com/urfave/cli/v2 v2.6.0/go.mod h1:oDzoM7pVwz6wHn5ogWgFUU1s4VJayeQS+aEZDqXIEJs=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20220518171630-0b5c67f07fdf h1:oXVg4h2qJDd9htKxb5SCpFBHLipW6hXmL3qpUixS2jw=
golang.org/x/exp v0.0.0-20220518171630-0b5c67f07fdf/go.mod h1:yh0Ynu2b5ZUe3MQfp2nM0ecK7wsgouWTDN0FNeJuIys=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand Down Expand Up @@ -151,3 +149,4 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"path/filepath"
"regexp"
"runtime"
"slices"

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)

Check failure on line 14 in utils/utils.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.20.7/x64/src/slices)
"strings"

"github.com/iawia002/lia/array"
"github.com/pkg/errors"

"github.com/iawia002/lux/request"
Expand Down Expand Up @@ -152,7 +152,7 @@ func ParseInputFile(r io.Reader, items string, itemStart, itemEnd int) []string

itemList := make([]string, 0, len(wantedItems))
for i, item := range temp {
if array.ItemInArray(i+1, wantedItems) {
if slices.Contains(wantedItems, i+1) {
itemList = append(itemList, item)
}
}
Expand Down

0 comments on commit c877236

Please sign in to comment.