Skip to content

Commit d1d2d52

Browse files
committed
merge with master
2 parents 2761d6b + ec696d4 commit d1d2d52

40 files changed

+1969
-852
lines changed

Diff for: .github/ISSUE_TEMPLATE/BUG-REPORT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe your issue in as much detail as possible here
1313

1414
### Your environment
1515

16-
* Go version (example: go1.22.4)
16+
* Go version (example: go1.23.4)
1717
* OS and CPU architecture (example: linux/amd64)
1818
* Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c)
1919

Diff for: .github/golangci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
run:
22
concurrency: 8
33
timeout: 10m
4-
issue-exit-code: 1
4+
issues-exit-code: 1
55
tests: true
6-
skip-dirs-use-default: true
76
modules-download-mode: readonly
87
allow-parallel-runners: false
98
go: ""
109

1110
output:
12-
uniq-by-line: false
1311
path-prefix: ""
1412
sort-results: true
1513

@@ -55,7 +53,7 @@ linters-settings:
5553
- G306 # Expect WriteFile permissions to be 0600 or less
5654
- G115 # Integer overflow conversion, no solution to check the overflow in time of convert, so linter shouldn't check the overflow.
5755
stylecheck:
58-
checks: [ "all", "-ST1022", "-ST1003" ]
56+
checks: ["all", "-ST1022", "-ST1003"]
5957
errorlint:
6058
asserts: false
6159

@@ -78,6 +76,8 @@ issues:
7876
max-same-issues: 0
7977
new: false
8078
fix: false
79+
exclude-dirs-use-default: true
80+
uniq-by-line: false
8181

8282
exclude-rules:
8383
- path: _test\.go

Diff for: .github/goreleaser.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ builds:
6767
goarch:
6868
- amd64
6969
- arm64
70+
- id: gnodev
71+
dir: ./contribs/gnodev/cmd/gnodev
72+
binary: gnodev
73+
ldflags:
74+
# using hardcoded ldflag
75+
- -X github.com/gnolang/gno/gnovm/pkg/gnoenv._GNOROOT=/gnoroot
76+
env:
77+
- CGO_ENABLED=0
78+
goos:
79+
- linux
80+
- darwin
81+
goarch:
82+
- amd64
83+
- arm64
7084
# Gno Contribs
7185
# NOTE: Contribs binary will be added in a single docker image below: gnocontribs
7286
- id: gnobro
@@ -307,6 +321,48 @@ dockers:
307321
ids:
308322
- gnofaucet
309323

324+
# gnodev
325+
- use: buildx
326+
dockerfile: Dockerfile.release
327+
goos: linux
328+
goarch: amd64
329+
image_templates:
330+
- "ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Version }}-amd64"
331+
- "ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Env.TAG_VERSION }}-amd64"
332+
build_flag_templates:
333+
- "--target=gnodev"
334+
- "--platform=linux/amd64"
335+
- "--label=org.opencontainers.image.created={{.Date}}"
336+
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnodev"
337+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
338+
- "--label=org.opencontainers.image.version={{.Version}}"
339+
ids:
340+
- gnodev
341+
extra_files:
342+
- examples
343+
- gno.land/genesis/genesis_balances.txt
344+
- gno.land/genesis/genesis_txs.jsonl
345+
- use: buildx
346+
dockerfile: Dockerfile.release
347+
goos: linux
348+
goarch: arm64
349+
image_templates:
350+
- "ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Version }}-arm64v8"
351+
- "ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Env.TAG_VERSION }}-arm64v8"
352+
build_flag_templates:
353+
- "--target=gnodev"
354+
- "--platform=linux/arm64/v8"
355+
- "--label=org.opencontainers.image.created={{.Date}}"
356+
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnodev"
357+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
358+
- "--label=org.opencontainers.image.version={{.Version}}"
359+
ids:
360+
- gnodev
361+
extra_files:
362+
- examples
363+
- gno.land/genesis/genesis_balances.txt
364+
- gno.land/genesis/genesis_txs.jsonl
365+
310366
# gnocontribs
311367
- use: buildx
312368
dockerfile: Dockerfile.release
@@ -406,6 +462,16 @@ docker_manifests:
406462
- ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-amd64
407463
- ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-arm64v8
408464

465+
# gnodev
466+
- name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Version }}
467+
image_templates:
468+
- ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Version }}-amd64
469+
- ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Version }}-arm64v8
470+
- name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Env.TAG_VERSION }}
471+
image_templates:
472+
- ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Env.TAG_VERSION }}-amd64
473+
- ghcr.io/gnolang/{{ .ProjectName }}/gnodev:{{ .Env.TAG_VERSION }}-arm64v8
474+
409475
# gnocontribs
410476
- name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnocontribs:{{ .Version }}
411477
image_templates:

Diff for: .github/workflows/docs-linter.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
1818

19-
- name: Set up Go
19+
- name: Set up Go (docs builder)
2020
uses: actions/setup-go@v5
2121
with:
22-
go-version-file: go.mod
22+
go-version-file: misc/devdeps/go.mod
2323

24-
- name: Install dependencies
24+
- name: Install dependencies (docs builder)
25+
working-directory: misc/devdeps
2526
run: go mod download
2627

2728
- name: Build docs
@@ -30,5 +31,14 @@ jobs:
3031
- name: Check diff
3132
run: git diff --exit-code || (echo "Some docs files are not formatted, please run 'make build'." && exit 1)
3233

34+
- name: Set up Go (docs linter)
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version-file: misc/docs-linter/go.mod
38+
39+
- name: Install dependencies (docs linter)
40+
working-directory: misc/docs-linter
41+
run: go mod download
42+
3343
- name: Run linter
3444
run: make -C docs/ lint

Diff for: .github/workflows/examples.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
goversion:
23-
- "1.22.x"
23+
- "1.23.x"
2424
runs-on: ubuntu-latest
2525
timeout-minutes: 30
2626
steps:
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
goversion:
38-
- "1.22.x"
38+
- "1.23.x"
3939
# unittests: TODO: matrix with contracts
4040
runs-on: ubuntu-latest
4141
timeout-minutes: 30
@@ -58,7 +58,7 @@ jobs:
5858
fail-fast: false
5959
matrix:
6060
goversion:
61-
- "1.22.x"
61+
- "1.23.x"
6262
# unittests: TODO: matrix with contracts
6363
runs-on: ubuntu-latest
6464
timeout-minutes: 10
@@ -83,13 +83,13 @@ jobs:
8383
uses: ./.github/workflows/build_template.yml
8484
with:
8585
modulepath: "examples"
86-
go-version: "1.22.x"
86+
go-version: "1.23.x"
8787

8888
mod-tidy:
8989
strategy:
9090
fail-fast: false
9191
matrix:
92-
go-version: [ "1.22.x" ]
92+
go-version: [ "1.23.x" ]
9393
# unittests: TODO: matrix with contracts
9494
runs-on: ubuntu-latest
9595
timeout-minutes: 10

Diff for: .github/workflows/gnofmt_template.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
description: "Go version to use"
1010
required: false
1111
type: string
12-
default: "1.22.x"
12+
default: "1.23.x"
1313

1414
jobs:
1515
fmt:

Diff for: .github/workflows/gnoland.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
go-version: ["1.22.x"]
36+
go-version: ["1.23.x"]
3737
# unittests: TODO: matrix with contracts
3838
runs-on: ubuntu-latest
3939
timeout-minutes: 10

Diff for: .github/workflows/lint_template.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ jobs:
2222
uses: golangci/golangci-lint-action@v6
2323
with:
2424
working-directory: ${{ inputs.modulepath }}
25-
args:
26-
--config=${{ github.workspace }}/.github/golangci.yml
27-
version: v1.62 # sync with misc/devdeps
25+
args: --config=${{ github.workspace }}/.github/golangci.yml
26+
version: v1.64 # sync with misc/devdeps

Diff for: .github/workflows/main_template.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
description: "Go version to use"
1212
required: false
1313
type: string
14-
default: "1.22.x"
14+
default: "1.23.x"
1515
secrets:
1616
codecov-token:
1717
required: true

Diff for: Dockerfile.release

+12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ COPY ./gnofaucet /usr/bin/gnofaucet
4444
EXPOSE 5050
4545
ENTRYPOINT [ "/usr/bin/gnofaucet" ]
4646

47+
#
48+
## ghcr.io/gnolang/gno/gnodev
49+
FROM base as gnodev
50+
51+
COPY ./gnodev /usr/bin/gnodev
52+
COPY ./examples /gnoroot/examples/
53+
COPY ./gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
54+
COPY ./gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
55+
# gnoweb exposed by default
56+
EXPOSE 8888
57+
ENTRYPOINT [ "/usr/bin/gnodev" ]
58+
4759
#
4860
## ghcr.io/gnolang/gno
4961
FROM base as gno

Diff for: examples/gno.land/r/leon/config/config.gno

+30-63
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@ package config
33
import (
44
"errors"
55
"std"
6-
"strconv"
76
"strings"
87
"time"
98

109
"gno.land/p/demo/avl"
11-
p "gno.land/p/demo/avl/pager"
1210
"gno.land/p/demo/ownable"
13-
"gno.land/p/demo/ufmt"
14-
"gno.land/p/moul/md"
15-
"gno.land/p/moul/realmpath"
11+
"gno.land/p/demo/seqid"
1612
)
1713

1814
var (
15+
cfgID seqid.ID
1916
configs = avl.NewTree()
20-
pager = p.NewPager(configs, 10, false)
21-
banner = "---\n[[Leon's Home page]](/r/leon/home) | [[GitHub: @leohhhn]](https://github.com/leohhhn)\n\n---"
17+
2218
absPath = strings.TrimPrefix(std.CurrentRealm().PkgPath(), std.ChainDomain())
2319

2420
// SafeObjects
@@ -29,6 +25,8 @@ var (
2925
)
3026

3127
type Config struct {
28+
id seqid.ID
29+
name string
3230
lines string
3331
updated time.Time
3432
}
@@ -38,19 +36,39 @@ func AddConfig(name, lines string) {
3836
panic(ErrUnauthorized)
3937
}
4038

41-
configs.Set(name, Config{
39+
id := cfgID.Next()
40+
configs.Set(id.String(), Config{
41+
id: id,
42+
name: name,
4243
lines: lines,
4344
updated: time.Now(),
44-
}) // no overwrite check
45+
})
4546
}
4647

47-
func RemoveConfig(name string) {
48+
func EditConfig(id string, name, lines string) {
49+
if !IsAuthorized(std.PrevRealm().Addr()) {
50+
panic(ErrUnauthorized)
51+
}
52+
53+
raw, ok := configs.Remove(id)
54+
if !ok {
55+
panic("no config with that id")
56+
}
57+
58+
conf := raw.(Config)
59+
// Overwrites data
60+
conf.lines = lines
61+
conf.name = name
62+
conf.updated = time.Now()
63+
}
64+
65+
func RemoveConfig(id string) {
4866
if !IsAuthorized(std.PreviousRealm().Address()) {
4967
panic(ErrUnauthorized)
5068
}
5169

52-
if _, ok := configs.Remove(name); !ok {
53-
panic("no config with that name")
70+
if _, ok := configs.Remove(id); !ok {
71+
panic("no config with that id")
5472
}
5573
}
5674

@@ -65,54 +83,3 @@ func UpdateBanner(newBanner string) {
6583
func IsAuthorized(addr std.Address) bool {
6684
return addr == OwnableMain.Owner() || addr == OwnableBackup.Owner()
6785
}
68-
69-
func Banner() string {
70-
return banner
71-
}
72-
73-
func Render(path string) (out string) {
74-
req := realmpath.Parse(path)
75-
if req.Path == "" {
76-
out += md.H1("Leon's config package")
77-
78-
out += ufmt.Sprintf("Leon's main address: %s\n\n", OwnableMain.Owner().String())
79-
out += ufmt.Sprintf("Leon's backup address: %s\n\n", OwnableBackup.Owner().String())
80-
81-
out += md.H2("Leon's configs")
82-
83-
if configs.Size() == 0 {
84-
out += "No configs yet :c\n\n"
85-
}
86-
87-
page := pager.MustGetPageByPath(path)
88-
for _, item := range page.Items {
89-
out += ufmt.Sprintf("- [%s](%s:%s)\n\n", item.Key, absPath, item.Key)
90-
}
91-
92-
out += page.Picker()
93-
out += "\n\n"
94-
out += "Page " + strconv.Itoa(page.PageNumber) + " of " + strconv.Itoa(page.TotalPages) + "\n\n"
95-
96-
out += Banner()
97-
98-
return out
99-
}
100-
101-
return renderConfPage(req.Path)
102-
}
103-
104-
func renderConfPage(confName string) (out string) {
105-
raw, ok := configs.Get(confName)
106-
if !ok {
107-
out += md.H1("404")
108-
out += "That config does not exist :/"
109-
return out
110-
}
111-
112-
conf := raw.(Config)
113-
out += md.H1(confName)
114-
out += ufmt.Sprintf("```\n%s\n```\n\n", conf.lines)
115-
out += ufmt.Sprintf("_Last updated on %s_", conf.updated.Format("02 Jan, 2006"))
116-
117-
return out
118-
}

0 commit comments

Comments
 (0)