diff --git a/.codebeatsettings b/.codebeatsettings
deleted file mode 100644
index fbca893..0000000
--- a/.codebeatsettings
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "GOLANG": {
- "ABC": [15, 25, 50, 70],
- "LOC": [30, 45, 70, 100],
- "TOO_MANY_IVARS": [12, 16, 20, 24],
- "TOO_MANY_FUNCTIONS": [50, 70, 90, 120],
- "TOTAL_LOC": [500, 750, 1000, 2000]
- }
-}
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index d0ad1de..605744a 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -6,7 +6,7 @@ updates:
target-branch: "develop"
schedule:
interval: "daily"
- timezone: "Europe/London"
+ timezone: "Etc/UTC"
time: "03:00"
labels:
- "PR • MAINTENANCE"
@@ -26,8 +26,8 @@ updates:
target-branch: "develop"
schedule:
interval: "daily"
- timezone: "Europe/London"
- time: "04:00"
+ timezone: "Etc/UTC"
+ time: "03:00"
labels:
- "PR • MAINTENANCE"
assignees:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7f99348..24f81c3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
- go: [ '1.19.x', '1.20.x', '1.21.x', '1.22.x' ]
+ go: [ '1.22.x', '1.23.x' ]
steps:
- name: Checkout
@@ -61,7 +61,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
- go-version: '1.21.x'
+ go-version: '1.22.x'
- name: Download dependencies
run: make deps
diff --git a/Makefile b/Makefile
index 79ae4b7..cf32fa1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
################################################################################
-# This Makefile generated by GoMakeGen 3.0.1 using next command:
+# This Makefile generated by GoMakeGen 3.2.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
@@ -11,6 +11,16 @@ ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif
+ifdef PROXY ## Force proxy usage for downloading dependencies (Flag)
+export GOPROXY=https://proxy.golang.org/cached-only,direct
+endif
+
+ifdef CGO ## Enable CGO usage (Flag)
+export CGO_ENABLED=1
+else
+export CGO_ENABLED=0
+endif
+
COMPAT ?= 1.19
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)
@@ -107,8 +117,9 @@ help: ## Show this info
@echo -e '\n\033[1mVariables:\033[0m\n'
@grep -E '^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST))) \
| sed 's/ifdef //' \
+ | sort -h \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-11s\033[0m %s\n", $$1, $$2}'
@echo -e ''
- @echo -e '\033[90mGenerated by GoMakeGen 3.0.1\033[0m\n'
+ @echo -e '\033[90mGenerated by GoMakeGen 3.2.0\033[0m\n'
################################################################################
diff --git a/README.md b/README.md
index e9200cf..1e4c15d 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
-
-
+
+
-Screenshots • Installation • Command-line completion • Man documentation • FAQ • Usage • CI Status • Contributing • Thanks • License
+Screenshots • Installation • Command-line completion • Man documentation • FAQ • Usage
CI Status • Contributing • Thanks • License
@@ -25,7 +25,7 @@
#### From source
-To build the _aligo_ from scratch, make sure you have a working Go 1.19+ workspace (_[instructions](https://go.dev/doc/install)_), then:
+To build the _aligo_ from scratch, make sure you have a working [Go 1.22+](https://github.com/essentialkaos/.github/blob/master/GO-VERSION-SUPPORT.md) workspace (_[instructions](https://go.dev/doc/install)_), then:
```
go install github.com/essentialkaos/aligo/v2@latest
@@ -56,7 +56,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
- go-version: '1.20.x'
+ go-version: '1.22.x'
- name: Check Golang sources with Aligo
uses: essentialkaos/aligo-action@v2
diff --git a/cli/cli.go b/cli/cli.go
index f9b9670..9699d7a 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -15,22 +15,22 @@ import (
"runtime"
"strings"
- "github.com/essentialkaos/ek/v12/fmtc"
- "github.com/essentialkaos/ek/v12/fmtutil"
- "github.com/essentialkaos/ek/v12/options"
- "github.com/essentialkaos/ek/v12/pager"
- "github.com/essentialkaos/ek/v12/strutil"
- "github.com/essentialkaos/ek/v12/support"
- "github.com/essentialkaos/ek/v12/support/apps"
- "github.com/essentialkaos/ek/v12/support/deps"
- "github.com/essentialkaos/ek/v12/terminal"
- "github.com/essentialkaos/ek/v12/terminal/tty"
- "github.com/essentialkaos/ek/v12/usage"
- "github.com/essentialkaos/ek/v12/usage/completion/bash"
- "github.com/essentialkaos/ek/v12/usage/completion/fish"
- "github.com/essentialkaos/ek/v12/usage/completion/zsh"
- "github.com/essentialkaos/ek/v12/usage/man"
- "github.com/essentialkaos/ek/v12/usage/update"
+ "github.com/essentialkaos/ek/v13/fmtc"
+ "github.com/essentialkaos/ek/v13/fmtutil"
+ "github.com/essentialkaos/ek/v13/options"
+ "github.com/essentialkaos/ek/v13/pager"
+ "github.com/essentialkaos/ek/v13/strutil"
+ "github.com/essentialkaos/ek/v13/support"
+ "github.com/essentialkaos/ek/v13/support/apps"
+ "github.com/essentialkaos/ek/v13/support/deps"
+ "github.com/essentialkaos/ek/v13/terminal"
+ "github.com/essentialkaos/ek/v13/terminal/tty"
+ "github.com/essentialkaos/ek/v13/usage"
+ "github.com/essentialkaos/ek/v13/usage/completion/bash"
+ "github.com/essentialkaos/ek/v13/usage/completion/fish"
+ "github.com/essentialkaos/ek/v13/usage/completion/zsh"
+ "github.com/essentialkaos/ek/v13/usage/man"
+ "github.com/essentialkaos/ek/v13/usage/update"
"github.com/essentialkaos/aligo/v2/cli/i18n"
"github.com/essentialkaos/aligo/v2/inspect"
@@ -41,7 +41,7 @@ import (
// App info
const (
APP = "aligo"
- VER = "2.2.1"
+ VER = "2.2.2"
)
// Constants with options names
@@ -90,7 +90,7 @@ func Run(gitRev string, gomod []byte) {
if !errs.IsEmpty() {
terminal.Error(i18n.UI.ERRORS.OPTION_PARSING.Add("", ":"))
- terminal.Error(errs.String())
+ terminal.Error(errs.Error("- "))
os.Exit(1)
}
diff --git a/cli/i18n/i18n.go b/cli/i18n/i18n.go
index c5b29b7..305bf20 100644
--- a/cli/i18n/i18n.go
+++ b/cli/i18n/i18n.go
@@ -11,7 +11,7 @@ import (
"os"
"strings"
- "github.com/essentialkaos/ek/v12/i18n"
+ "github.com/essentialkaos/ek/v13/i18n"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/cli/render.go b/cli/render.go
index fcc9aaf..e73f805 100644
--- a/cli/render.go
+++ b/cli/render.go
@@ -11,10 +11,10 @@ import (
"fmt"
"strings"
- "github.com/essentialkaos/ek/v12/fmtc"
- "github.com/essentialkaos/ek/v12/fmtutil"
- "github.com/essentialkaos/ek/v12/mathutil"
- "github.com/essentialkaos/ek/v12/terminal"
+ "github.com/essentialkaos/ek/v13/fmtc"
+ "github.com/essentialkaos/ek/v13/fmtutil"
+ "github.com/essentialkaos/ek/v13/mathutil"
+ "github.com/essentialkaos/ek/v13/terminal"
"github.com/essentialkaos/aligo/v2/cli/i18n"
"github.com/essentialkaos/aligo/v2/inspect"
@@ -283,6 +283,12 @@ func printCurrentFieldsInfo(fields []*report.Field) {
fmt.Print(strings.Repeat(" ", int(counter+1)))
+ // Ensure we don't panic when hitting an empty struct{}.
+ if field.Size == 0 {
+ fmtc.NewLine()
+ continue
+ }
+
for counter%field.Size != 0 {
fmtc.Printf("{r}□{!} ")
counter++
diff --git a/go.mod b/go.mod
index c163558..842be22 100644
--- a/go.mod
+++ b/go.mod
@@ -1,16 +1,16 @@
module github.com/essentialkaos/aligo/v2
-go 1.18
+go 1.22.8
require (
- github.com/essentialkaos/ek/v12 v12.126.1
+ github.com/essentialkaos/ek/v13 v13.9.2
github.com/kisielk/gotool v1.0.0
- golang.org/x/tools v0.22.0
+ golang.org/x/tools v0.26.0
)
require (
- github.com/essentialkaos/depsy v1.3.0 // indirect
- golang.org/x/mod v0.18.0 // indirect
- golang.org/x/sync v0.7.0 // indirect
- golang.org/x/sys v0.21.0 // indirect
+ github.com/essentialkaos/depsy v1.3.1 // indirect
+ golang.org/x/mod v0.21.0 // indirect
+ golang.org/x/sync v0.8.0 // indirect
+ golang.org/x/sys v0.26.0 // indirect
)
diff --git a/go.sum b/go.sum
index 88c9815..3f7c5d9 100644
--- a/go.sum
+++ b/go.sum
@@ -1,18 +1,22 @@
-github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
-github.com/essentialkaos/depsy v1.3.0 h1:CN7bRgBU2jGTHSkg/Sh38eDUn7cvmaTp2sxFt2HpFeU=
-github.com/essentialkaos/depsy v1.3.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8=
-github.com/essentialkaos/ek/v12 v12.126.1 h1:K4tCpu9T3k5Bv6hJ1lmW7Ou0GxjgjBIKRsoZgAGdEhE=
-github.com/essentialkaos/ek/v12 v12.126.1/go.mod h1:71IJ7m82hgjrvWnhL+z0vIhguxz47/rfVma5/CeI5Fw=
+github.com/essentialkaos/check v1.4.1 h1:SuxXzrbokPGTPWxGRnzy0hXvtb44mtVrdNxgPa1s4c8=
+github.com/essentialkaos/check v1.4.1/go.mod h1:xQOYwFvnxfVZyt5Qvjoa1SxcRqu5VyP77pgALr3iu+M=
+github.com/essentialkaos/depsy v1.3.1 h1:00k9QcMsdPM4IzDaEFHsTHBD/zoM0oxtB5+dMUwbQa8=
+github.com/essentialkaos/depsy v1.3.1/go.mod h1:B5+7Jhv2a2RacOAxIKU2OeJp9QfZjwIpEEPI5X7auWM=
+github.com/essentialkaos/ek/v13 v13.9.2 h1:3sXGDUZ5C5+8tSmat1cTj6lhYIzCOlcaHC2ulShF2OQ=
+github.com/essentialkaos/ek/v13 v13.9.2/go.mod h1:6G9EPJ/k4N0mugTLqPuWS/fb7K5JwoEqZSkNSfBCsgg=
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
-golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
-golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
-golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
-golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
-golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
+github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
+golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
+golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
+golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
+golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
diff --git a/inspect/inspect.go b/inspect/inspect.go
index 2e03d7c..f45fbcf 100644
--- a/inspect/inspect.go
+++ b/inspect/inspect.go
@@ -186,7 +186,8 @@ func getStructReport(info *structInfo) *report.Struct {
Ignore: info.Skip,
}
- numFields := info.Type.NumFields()
+ // Use AST fields list length, otherwise List[i] below can panic.
+ numFields := len(info.AST.Fields.List)
for i := 0; i < numFields; i++ {
f := info.Type.Field(i)