Skip to content

Commit 68806e4

Browse files
authored
Merge pull request #38 from rroller/master
2 parents 36ea47d + d6b4e19 commit 68806e4

File tree

12 files changed

+59
-510
lines changed

12 files changed

+59
-510
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@v4
2222
with:
23-
go-version: '1.22'
23+
go-version: '1.24'
2424

2525
- name: Login to Docker Hub
2626
uses: docker/login-action@v2

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
go-version: [1.22.x]
14+
go-version: [1.24.x]
1515
platform: [ubuntu-latest, macos-latest, windows-latest]
1616
runs-on: ${{ matrix.platform }}
1717
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
dist/
2+
ddns
3+
.idea/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:latest as builder
1+
FROM alpine:latest AS builder
22

33
FROM scratch
44

conf/conf_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package conf
22

33
import (
4-
"io/ioutil"
54
"os"
65
"strings"
76
"testing"
@@ -14,7 +13,7 @@ func createTmpFile(t *testing.T) (string, func()) {
1413
is := is.New(t)
1514
is.Helper()
1615

17-
f, err := ioutil.TempFile("", "demo-*.yml")
16+
f, err := os.CreateTemp("", "demo-*.yml")
1817
is.NoErr(err)
1918

2019
rm := func() {
@@ -28,7 +27,7 @@ func TestNewConfigurationMultipleDomainsSuccess(t *testing.T) {
2827
fname, rm := createTmpFile(t)
2928
defer rm()
3029

31-
err := ioutil.WriteFile(fname, []byte(`token: amazing
30+
err := os.WriteFile(fname, []byte(`token: amazing
3231
domains:
3332
example.com:
3433
- type: A
@@ -65,7 +64,7 @@ func TestNewConfigurationParseError(t *testing.T) {
6564
fname, rm := createTmpFile(t)
6665
defer rm()
6766

68-
err := ioutil.WriteFile(fname, []byte(`is not yml`), 0644)
67+
err := os.WriteFile(fname, []byte(`is not yml`), 0644)
6968
is.NoErr(err)
7069

7170
_, err = NewConfiguration(fname)
@@ -78,7 +77,7 @@ func TestNewConfigurationValid(t *testing.T) {
7877
defer rm()
7978

8079
// check for token
81-
err := ioutil.WriteFile(fname, []byte(`token: ""
80+
err := os.WriteFile(fname, []byte(`token: ""
8281
domains:
8382
example.com:`), 0644)
8483
is.NoErr(err)
@@ -87,15 +86,15 @@ domains:
8786
is.True(strings.Contains(err.Error(), "token can't be empty"))
8887

8988
// check for domains
90-
err = ioutil.WriteFile(fname, []byte(`token: abc
89+
err = os.WriteFile(fname, []byte(`token: abc
9190
domains:`), 0644)
9291
is.NoErr(err)
9392

9493
_, err = NewConfiguration(fname)
9594
is.True(strings.Contains(err.Error(), "domains can't be empty"))
9695

9796
// check for domain records
98-
err = ioutil.WriteFile(fname, []byte(`token: abc
97+
err = os.WriteFile(fname, []byte(`token: abc
9998
domains:
10099
example.com: []`), 0644)
101100
is.NoErr(err)
@@ -110,7 +109,7 @@ func TestEnvVarsAreRead(t *testing.T) {
110109
fname, rm := createTmpFile(t)
111110
defer rm()
112111

113-
err := ioutil.WriteFile(fname, []byte(`domains:
112+
err := os.WriteFile(fname, []byte(`domains:
114113
example.com:
115114
- type: A
116115
name: www`), 0644)

do/do_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func httpHelper(t *testing.T, reqMethod, path, res string, resCode int) (string,
2323
is.Equal(r.URL.Path, path)
2424

2525
w.WriteHeader(resCode)
26-
w.Write([]byte(res))
26+
_, _ = w.Write([]byte(res))
2727
}))
2828

2929
return server.URL, server.Close

go.mod

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
module github.com/skibish/ddns
22

3-
go 1.22
3+
go 1.24
44

55
require (
6-
github.com/matryer/is v1.4.0
6+
github.com/matryer/is v1.4.1
77
github.com/mitchellh/mapstructure v1.5.0
88
github.com/sirupsen/logrus v1.9.3
99
github.com/spf13/viper v1.19.0
1010
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
1111
)
1212

1313
require (
14-
github.com/fsnotify/fsnotify v1.7.0 // indirect
14+
github.com/fsnotify/fsnotify v1.8.0 // indirect
1515
github.com/hashicorp/hcl v1.0.0 // indirect
16-
github.com/magiconair/properties v1.8.7 // indirect
17-
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
18-
github.com/sagikazarmark/locafero v0.4.0 // indirect
16+
github.com/magiconair/properties v1.8.9 // indirect
17+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
18+
github.com/sagikazarmark/locafero v0.7.0 // indirect
1919
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
2020
github.com/sourcegraph/conc v0.3.0 // indirect
21-
github.com/spf13/afero v1.11.0 // indirect
22-
github.com/spf13/cast v1.6.0 // indirect
23-
github.com/spf13/pflag v1.0.5 // indirect
21+
github.com/spf13/afero v1.12.0 // indirect
22+
github.com/spf13/cast v1.7.1 // indirect
23+
github.com/spf13/pflag v1.0.6 // indirect
2424
github.com/subosito/gotenv v1.6.0 // indirect
2525
go.uber.org/multierr v1.11.0 // indirect
26-
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
27-
golang.org/x/sys v0.20.0 // indirect
28-
golang.org/x/text v0.15.0 // indirect
26+
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect
27+
golang.org/x/sys v0.30.0 // indirect
28+
golang.org/x/text v0.22.0 // indirect
2929
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
3030
gopkg.in/ini.v1 v1.67.0 // indirect
3131
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 27 additions & 479 deletions
Large diffs are not rendered by default.

ipprovider/icanhazip.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ipprovider
33
import (
44
"context"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"strings"
99
"time"
@@ -50,7 +50,7 @@ func (i *icanhazip) GetIP(ctx context.Context) (string, error) {
5050
return "", fmt.Errorf("status code is not in success range: %d", resp.StatusCode)
5151
}
5252

53-
b, err := ioutil.ReadAll(resp.Body)
53+
b, err := io.ReadAll(resp.Body)
5454
if err != nil {
5555
return "", fmt.Errorf("failed to read the body of the response: %d", resp.StatusCode)
5656
}

ipprovider/ipprovider_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ipprovider
22

33
import (
44
"context"
5-
"io/ioutil"
5+
"io"
66
"net/http"
77
"net/http/httptest"
88
"os"
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func TestMain(m *testing.M) {
18-
log.SetOutput(ioutil.Discard)
18+
log.SetOutput(io.Discard)
1919
os.Exit(m.Run())
2020
}
2121

@@ -28,7 +28,7 @@ func httpHelper(t *testing.T, response string, headers map[string]string, status
2828
w.Header().Add(k, v)
2929
}
3030
w.WriteHeader(statusCode)
31-
w.Write([]byte(response))
31+
_, _ = w.Write([]byte(response))
3232
}))
3333

3434
return server.URL, server.Close

0 commit comments

Comments
 (0)