Skip to content

Commit

Permalink
Update all code deps (#292)
Browse files Browse the repository at this point in the history
* update all code deps

* fix CI errors

* update golangci-lint and golang version used by github actions workflow

* print golangci-lint version on make lint
  • Loading branch information
0pcom authored Oct 19, 2024
1 parent c45754b commit 022283c
Show file tree
Hide file tree
Showing 981 changed files with 238,882 additions and 80,317 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Release
# only trigger on pull request closed events
on:
push:
tags:
- '*'
tags:
- '*'
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- uses: actions/checkout@v4
- name: Install Requirements
run: |
Expand All @@ -21,14 +21,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make github-release

darwin:
needs: linux
runs-on: macos-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- uses: actions/checkout@v4
- name: Install Requirements
run: |
Expand All @@ -39,14 +39,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make github-release-darwin

windows:
needs: darwin
runs-on: windows-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x
- uses: actions/checkout@v4
- name: Install Requirements
shell: pwsh
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.4
go-version: 1.23.1
- uses: actions/checkout@v3
- name: Install Requirements
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
go mod vendor
- name: Checking Format and Testing
run: make check
- name: Build
run: make build

darwin:
needs: linux
runs-on: macos-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21.4
go-version: 1.23.1
- uses: actions/checkout@v3
- name: Install Requirements
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
go mod vendor
- name: Checking Format and Testing
run: make check
- name: Build
run: make build

windows:
needs: linux
runs-on: windows-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21.4
go-version: 1.23.1
- uses: actions/checkout@v3
- name: Install Requirements
run: |
choco install make
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
go mod vendor
- name: Testing
run: |
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ check: lint test ## Run linters and tests
check-windows: lint test-windows ## Run linters and tests on windows

lint: ## Run linters. Use make install-linters first
golangci-lint version
${OPTS} golangci-lint run -c .golangci.yml ./cmd/...
${OPTS} golangci-lint run -c .golangci.yml ./pkg/...
${OPTS} golangci-lint run -c .golangci.yml ./internal/...
Expand Down
2 changes: 1 addition & 1 deletion cmd/dmsg-server/commands/config/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func init() {
var genConfigCmd = &cobra.Command{
Use: "gen",
Short: "Generate a config file",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
mLog := logging.NewMasterLogger()
mLog.SetLevel(logrus.InfoLevel)
logger := mLog.PackageLogger("dmsg-server config generator")
Expand Down
6 changes: 3 additions & 3 deletions cmd/dmsg-server/commands/start/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"strconv"

"github.com/go-chi/chi/v5"
chi "github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/skycoin/skywire-utilities/pkg/buildinfo"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
Expand Down Expand Up @@ -40,8 +40,8 @@ func init() {
var RootCmd = &cobra.Command{
Use: "start",
Short: "Start Dmsg Server",
PreRunE: func(cmd *cobra.Command, args []string) error { return sf.Check() },
Run: func(_ *cobra.Command, args []string) {
PreRunE: func(_ *cobra.Command, _ []string) error { return sf.Check() },
Run: func(_ *cobra.Command, _ []string) {
if _, err := buildinfo.Get().WriteTo(os.Stdout); err != nil {
log.Printf("Failed to output build info: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dmsg-socks5/commands/dmsg-socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var serveCmd = &cobra.Command{
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
log := logging.MustGetLogger("ssh-proxy")
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
Expand Down Expand Up @@ -178,7 +178,7 @@ var serveCmd = &cobra.Command{
var proxyCmd = &cobra.Command{
Use: "client",
Short: "socks5 proxy client for dmsg socks5 proxy server",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
log := logging.MustGetLogger("ssh-proxy-client")
var pubKey cipher.PubKey
err := pubKey.Set(pubk)
Expand Down
4 changes: 2 additions & 2 deletions cmd/dmsgcurl/commands/dmsgcurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ DMSG curl utility`,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
if dmsgcurlLog == nil {
dmsgcurlLog = logging.MustGetLogger("dmsgcurl")
}
Expand Down Expand Up @@ -254,7 +254,7 @@ func parseOutputFile(output string, replace bool) (*os.File, error) {
return nil, statErr
}
if replace {
return os.OpenFile(filepath.Clean(output), os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm)
return os.OpenFile(filepath.Clean(output), os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm) //nolint
}
return nil, os.ErrExist
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dmsghttp/commands/dmsghttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DMSG http file server`,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),

Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
log := logging.MustGetLogger("dmsghttp")
if dmsgDisc == "" {
log.Fatal("Dmsg Discovery URL not specified")
Expand Down
16 changes: 5 additions & 11 deletions cmd/dmsgip/commands/dmsgip.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,27 @@ import (
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire-utilities/pkg/skyenv"
"github.com/spf13/cobra"

"github.com/skycoin/dmsg/pkg/disc"
"github.com/skycoin/dmsg/pkg/dmsg"
)

var (
dmsgDisc string
dmsgDisc = dmsg.DiscAddr(false)
sk cipher.SecKey
logLvl string
dmsgServers []string
)

func init() {
RootCmd.Flags().StringVarP(&dmsgDisc, "dmsg-disc", "c", "", "dmsg discovery url default:\n"+skyenv.DmsgDiscAddr)
RootCmd.Flags().StringVarP(&dmsgDisc, "dmsg-disc", "c", dmsgDisc, "dmsg discovery url\033[0m")
RootCmd.Flags().StringVarP(&logLvl, "loglvl", "l", "fatal", "[ debug | warn | error | fatal | panic | trace | info ]\033[0m")
if os.Getenv("DMSGIP_SK") != "" {
sk.Set(os.Getenv("DMSGIP_SK")) //nolint
}
RootCmd.Flags().StringSliceVarP(&dmsgServers, "srv", "d", []string{}, "dmsg server public keys\n\r")
RootCmd.Flags().VarP(&sk, "sk", "s", "a random key is generated if unspecified\n\r")
RootCmd.Flags().StringSliceVarP(&dmsgServers, "srv", "d", []string{}, "dmsg server public keys\n\r\033[0m")
RootCmd.Flags().VarP(&sk, "sk", "s", "a random key is generated if unspecified\n\r\033[0m")
}

// RootCmd containsa the root dmsgcurl command
Expand All @@ -54,12 +53,7 @@ DMSG ip utility`,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),
PreRun: func(cmd *cobra.Command, args []string) {
if dmsgDisc == "" {
dmsgDisc = skyenv.DmsgDiscAddr
}
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
log := logging.MustGetLogger("dmsgip")

if logLvl != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dmsgpty-cli/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ DMSG pseudoterminal command line interface`,
remoteAddr.Port = dmsgpty.DefaultPort
}
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dmsgpty-cli/commands/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func init() {
var whitelistCmd = &cobra.Command{
Use: "whitelist",
Short: "lists all whitelisted public keys",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
wlC, err := cli.WhitelistClient()
if err != nil {
return err
Expand Down
7 changes: 3 additions & 4 deletions cmd/dmsgpty-host/commands/confgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ func init() {
}

var confgenCmd = &cobra.Command{
Use: "confgen <config.json>",
Short: "generates config file",
Args: cobra.MaximumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {},
Use: "confgen <config.json>",
Short: "generates config file",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

if len(args) == 0 {
Expand Down
3 changes: 1 addition & 2 deletions cmd/dmsgpty-host/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ DMSG host for pseudoterminal command line interface`,
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
PreRun: func(cmd *cobra.Command, args []string) {},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
conf, err := getConfig(cmd, false)
if err != nil {
return fmt.Errorf("failed to get config: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/dmsgpty-ui/commands/dmsgpty-ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var RootCmd = &cobra.Command{
│││││└─┐│ ┬├─┘ │ └┬┘───│ ││
─┴┘┴ ┴└─┘└─┘┴ ┴ ┴ └─┘┴
` + "DMSG pseudoterminal GUI",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}
Expand Down
10 changes: 7 additions & 3 deletions cmd/dmsgweb/commands/dmsgweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"syscall"

"github.com/bitfield/script"
"github.com/chen3feng/safecast"
"github.com/confiant-inc/go-socks5"
"github.com/gin-gonic/gin"
"github.com/skycoin/skywire-utilities/pkg/buildinfo"
Expand Down Expand Up @@ -99,7 +100,7 @@ dmsgweb conf file detected: ` + dmsgwebconffile
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),
Run: func(cmd *cobra.Command, _ []string) {
Run: func(_ *cobra.Command, _ []string) {
if isEnvs {
envfile := envfileLinux
if runtime.GOOS == "windows" {
Expand Down Expand Up @@ -390,8 +391,11 @@ func proxyTCPConn(n int) {
go func(conn net.Conn, n int) {
defer wg.Done()
defer conn.Close() //nolint

dmsgConn, err := dmsgC.DialStream(context.Background(), dmsg.Addr{PK: dialPK[n], Port: uint16(dmsgPorts[n])})
dp, ok := safecast.To[uint16](dmsgPorts[n])
if !ok {
dmsgWebLog.Fatal("uint16 overflow when converting dmsg port")
}
dmsgConn, err := dmsgC.DialStream(context.Background(), dmsg.Addr{PK: dialPK[n], Port: dp}) //nolint
if err != nil {
log.Printf("Failed to dial dmsg address %v:%v %v", dialPK[n].String(), dmsgPorts[n], err)
return
Expand Down
11 changes: 8 additions & 3 deletions cmd/dmsgweb/commands/dmsgwebsrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

"github.com/bitfield/script"
"github.com/chen3feng/safecast"
"github.com/gin-gonic/gin"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
Expand Down Expand Up @@ -152,15 +153,19 @@ func server() {
var listN []net.Listener

for _, dport := range dmsgPort {
lis, err := dmsgC.Listen(uint16(dport))
dp, ok := safecast.To[uint16](dport)
if !ok {
log.Fatal("uint16 overflow when converting dmsg port")
}
lis, err := dmsgC.Listen(dp)
if err != nil {
log.Fatalf("Error listening on port %d: %v", dport, err)
}

listN = append(listN, lis)

dport := dport
go func(l net.Listener, port uint) {
dport := dp
go func(l net.Listener, port uint16) {
<-ctx.Done()
if err := l.Close(); err != nil {
log.Printf("Error closing listener on port %d: %v", port, err)
Expand Down
13 changes: 11 additions & 2 deletions cmd/dmsgweb/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"time"

"github.com/bitfield/script"
"github.com/chen3feng/safecast"
"github.com/gin-gonic/gin"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
Expand Down Expand Up @@ -267,7 +268,11 @@ func scriptExecUint(s, envfile string) uint {
}
i, err := strconv.Atoi(strings.TrimSpace(strings.TrimRight(out, "\n")))
if err == nil {
return uint(i)
u, ok := safecast.To[uint](i)
if !ok {
log.Fatal("uint overflow")
}
return u
}
return 0
}
Expand All @@ -280,7 +285,11 @@ func scriptExecUint(s, envfile string) uint {
}
i, err := strconv.Atoi(z)
if err == nil {
return uint(i)
u, ok := safecast.To[uint](i)
if !ok {
log.Fatal("uint overflow")
}
return u
}
}
return uint(0)
Expand Down
Loading

0 comments on commit 022283c

Please sign in to comment.