Skip to content

Commit cf0eace

Browse files
authored
update deps and add possibility to use FICHENN_RC env variable (#16)
1 parent 1b152db commit cf0eace

6 files changed

Lines changed: 79 additions & 162 deletions

File tree

.github/workflows/release.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (c *controller) update() error {
104104
}
105105
fmt.Println(readme)
106106

107-
body, err := json.Marshal(map[string]interface{}{
107+
body, err := json.Marshal(map[string]any{
108108
"body": readme,
109109
})
110110

@@ -219,7 +219,7 @@ func (c *controller) request(method, url string, body io.Reader) (*http.Request,
219219
return req, nil
220220
}
221221

222-
func (c *controller) perform(req *http.Request, v interface{}) error {
222+
func (c *controller) perform(req *http.Request, v any) error {
223223
response, err := http.DefaultClient.Do(req)
224224
if err != nil {
225225
return fmt.Errorf("do: %w", err)

Taskfile.yml

Lines changed: 27 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
version: '3'
55

66
vars:
7-
VERSION: 0.4.6
7+
VERSION: 0.5.0
88
REVISION: { sh: git rev-parse HEAD }
99
WORKDIR: { sh: pwd }
1010

@@ -51,57 +51,32 @@ tasks:
5151
desc: Build all binaries
5252
cmds:
5353
- task: clean
54-
- mkdir -p {{.WORKDIR}}/dist
55-
56-
- task: build
57-
vars:
58-
BINARY_NAME: finn-linux-amd64
59-
TARGET_DIST: GOOS=linux GOARCH=amd64
60-
61-
- task: checksum
62-
vars:
63-
BINARY_NAME: finn-linux-amd64
64-
65-
- task: build
66-
vars:
67-
BINARY_NAME: finn-linux-arm64
68-
TARGET_DIST: GOOS=linux GOARCH=arm64
69-
70-
- task: checksum
71-
vars:
72-
BINARY_NAME: finn-linux-arm64
73-
74-
- task: build
75-
vars:
76-
BINARY_NAME: finn-darwin-amd64
77-
TARGET_DIST: GOOS=darwin GOARCH=amd64
78-
79-
- task: checksum
80-
vars:
81-
BINARY_NAME: finn-darwin-amd64
82-
83-
- task: build
84-
vars:
85-
BINARY_NAME: finn-darwin-arm64
86-
TARGET_DIST: GOOS=darwin GOARCH=arm64
87-
88-
- task: checksum
89-
vars:
90-
BINARY_NAME: finn-darwin-arm64
91-
92-
- task: build
93-
vars:
94-
BINARY_NAME: finn-windows-amd64.exe
95-
TARGET_DIST: GOOS=windows GOARCH=amd64
96-
97-
- task: checksum
98-
vars:
99-
BINARY_NAME: finn-windows-amd64.exe
100-
101-
build:
102-
dir: "{{.WORKDIR}}/cmd/finn"
103-
cmds:
104-
- '{{.TARGET_DIST}} go build -ldflags "{{.LDFLAGS | splitList "\n" | join " "}}" -o {{.WORKDIR}}/dist/{{.BINARY_NAME}} .'
54+
- mkdir -p dist
55+
# Supported dist: go tool dist list
56+
- |
57+
archs=(amd64 arm64)
58+
oses=(linux darwin openbsd freebsd netbsd)
59+
60+
for os in ${oses[@]}
61+
do
62+
for arch in ${archs[@]}
63+
do
64+
env GOOS=${os} GOARCH=${arch} go build -ldflags "{{.LDFLAGS | splitList "\n" | join " "}}" -o ./dist/finn-${os}-${arch} "{{.WORKDIR}}/cmd/finn/fichenn.go"
65+
( cd ./dist && checksum --algs="sha256" --append-to checksum.txt finn-${os}-${arch} )
66+
done
67+
done
68+
- |
69+
archs=(amd64 arm64)
70+
oses=(windows)
71+
72+
for os in ${oses[@]}
73+
do
74+
for arch in ${archs[@]}
75+
do
76+
env GOOS=${os} GOARCH=${arch} go build -ldflags "{{.LDFLAGS | splitList "\n" | join " "}}" -o ./dist/finn-${os}-${arch}.exe "{{.WORKDIR}}/cmd/finn/fichenn.go"
77+
( cd ./dist && checksum --algs="sha256" --append-to checksum.txt finn-${os}-${arch}.exe )
78+
done
79+
done
10580
vars:
10681
LDFLAGS: |
10782
-s
@@ -110,11 +85,6 @@ tasks:
11085
-X main.revision={{ printf "%.7s" .REVISION }}
11186
-X main.date={{now | date "2006-01-02~15:04:05"}}
11287
113-
checksum:
114-
dir: "{{.WORKDIR}}/dist"
115-
cmds:
116-
- checksum --algs="sha256" --append-to checksum.txt {{.BINARY_NAME}}
117-
11888
download:
11989
cmds:
12090
- curl -L {{.URL}} -o {{.DESTINATION}}

cmd/finn/fichenn.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import (
2828
"github.com/spf13/cobra"
2929
)
3030

31-
const runcom = ".fichennrc"
31+
const (
32+
runcom = ".fichennrc"
33+
runcomEnv = "FICHENN_RC"
34+
)
3235

3336
var (
3437
version = "dev"
@@ -118,7 +121,7 @@ func (c *controller) download(url string) error {
118121
return errors.Wrap(err, "could not get output file info")
119122
}
120123

121-
os.Chmod(c.output, stat.Mode()|os.FileMode(0111)) // chmod +x <output>
124+
os.Chmod(c.output, stat.Mode()|os.FileMode(0o111)) // chmod +x <output>
122125
}
123126

124127
return nil
@@ -192,11 +195,11 @@ func (c *controller) config() (*koanf.Koanf, error) {
192195
// Configuration
193196
konf := koanf.New(".")
194197

195-
defaults := map[string]interface{}{
198+
defaults := map[string]any{
196199
"passphrase_length": 24,
197200
"storage": "plik",
198201
"clipboard": true,
199-
"plik": map[string]interface{}{
202+
"plik": map[string]any{
200203
"url": "https://plik.root.gg",
201204
"ttl": "24h",
202205
"one_shot": false,
@@ -221,6 +224,12 @@ func (c *controller) config() (*koanf.Koanf, error) {
221224
}
222225

223226
func lookup() (string, error) {
227+
if path := os.Getenv(runcomEnv); path != "" {
228+
return path, nil
229+
}
230+
231+
//
232+
224233
workdir, err := os.Getwd()
225234
if err != nil {
226235
return "", errors.Wrap(err, "current directory:")

go.mod

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,43 @@
11
module github.com/mdouchement/fichenn
22

3-
go 1.23.0
4-
5-
toolchain go1.24.0
3+
go 1.25.0
64

75
require (
86
filippo.io/age v1.2.1
97
github.com/atotto/clipboard v0.1.4
10-
github.com/fxamacker/cbor/v2 v2.7.0
8+
github.com/fxamacker/cbor/v2 v2.9.0
119
github.com/gofrs/uuid v4.4.0+incompatible
1210
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
13-
github.com/klauspost/compress v1.18.0
11+
github.com/klauspost/compress v1.18.1
1412
github.com/knadh/koanf v1.5.0
15-
github.com/mdouchement/logger v0.0.0-20240212102128-d36bb9ae9641
13+
github.com/mdouchement/logger v0.0.0-20250429133203-f24114a58f5c
1614
github.com/pkg/errors v0.9.1
1715
github.com/rs/cors v1.11.1
1816
github.com/schollz/progressbar/v3 v3.18.0
1917
github.com/sirupsen/logrus v1.9.3
20-
github.com/spf13/cobra v1.9.1
18+
github.com/spf13/cobra v1.10.1
2119
github.com/vugu/vgrouter v0.0.0-20200725205318-eeb478c42e5d
2220
github.com/vugu/vjson v0.0.0-20200505061711-f9cbed27d3d9
2321
github.com/vugu/vugu v0.4.0
2422
gopkg.in/yaml.v3 v3.0.1
2523
)
2624

2725
require (
28-
github.com/fsnotify/fsnotify v1.8.0 // indirect
26+
github.com/fsnotify/fsnotify v1.9.0 // indirect
2927
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3028
github.com/mattn/go-colorable v0.1.14 // indirect
3129
github.com/mattn/go-isatty v0.0.20 // indirect
32-
github.com/mattn/go-runewidth v0.0.16 // indirect
3330
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
3431
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
3532
github.com/mitchellh/copystructure v1.2.0 // indirect
3633
github.com/mitchellh/mapstructure v1.5.0 // indirect
3734
github.com/mitchellh/reflectwalk v1.0.2 // indirect
3835
github.com/pelletier/go-toml v1.9.5 // indirect
3936
github.com/rivo/uniseg v0.4.7 // indirect
40-
github.com/spf13/pflag v1.0.6 // indirect
37+
github.com/spf13/pflag v1.0.10 // indirect
4138
github.com/vugu/xxhash v0.0.0-20191111030615-ed24d0179019 // indirect
4239
github.com/x448/float16 v0.8.4 // indirect
43-
golang.org/x/crypto v0.35.0 // indirect
44-
golang.org/x/sys v0.30.0 // indirect
45-
golang.org/x/term v0.29.0 // indirect
40+
golang.org/x/crypto v0.45.0 // indirect
41+
golang.org/x/sys v0.38.0 // indirect
42+
golang.org/x/term v0.37.0 // indirect
4643
)

0 commit comments

Comments
 (0)