Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.24"
go-version: "1.25"
- uses: actions/checkout@v4

- name: Check if generated files are up to date
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Dockerfile.public_node
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24
ARG GO_VERSION=1.25

# Base image with go compiler and tested source code
FROM --platform=$BUILDPLATFORM docker.io/library/golang:${GO_VERSION} AS build
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Dockerfile.static_datastore_builder
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24
ARG GO_VERSION=1.25

# Base image with go compiler and tested source code
FROM --platform=$BUILDPLATFORM docker.io/library/golang:${GO_VERSION} AS build
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Dockerfile.web_proxy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24
ARG GO_VERSION=1.25

# Base image with go compiler and tested source code
FROM --platform=$BUILDPLATFORM docker.io/library/golang:${GO_VERSION} AS build
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module github.com/cinode/go

go 1.24
go 1.25

require (
github.com/jbenet/go-base58 v0.0.0-20150317085156-6237cf65f3a6
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.10.0
golang.org/x/crypto v0.39.0
google.golang.org/protobuf v1.36.6
github.com/stretchr/testify v1.11.1
golang.org/x/crypto v0.41.0
google.golang.org/protobuf v1.36.8
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
golang.org/x/sys v0.33.0 // indirect
github.com/spf13/pflag v1.0.7 // indirect
golang.org/x/sys v0.35.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
19 changes: 10 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/cinodefs/uploader/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (s *DirectoryTestSuite) TestFailLinkUpload() {
testFS := &fstest.MapFS{
"file.txt": &fstest.MapFile{
Data: []byte("hello"),
Mode: fs.ModeSymlink,
Mode: fs.ModeCharDevice,
},
}

Expand Down
117 changes: 117 additions & 0 deletions scripts/update_go_and_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/bash

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

echo -e "${YELLOW}Fetching latest Go version...${NC}"

# Get the latest stable Go version
# Primary: official endpoint returns single line like 'go1.25.1'
latest_go_version=$(curl -fsSL https://go.dev/VERSION?m=text 2>/dev/null | head -n1 | sed 's/^go//')

if [ -z "$latest_go_version" ]; then
echo -e "${RED}Failed to detect latest Go version. Aborting.${NC}"
exit 1
fi

latest_go_minor_version=$(echo "$latest_go_version" | cut -d. -f1-2)

if [ -z "$latest_go_minor_version" ]; then
echo -e "${RED}Failed to detect latest Go version. Aborting.${NC}"
exit 1
fi

echo "Latest Go version available: $latest_go_version (minor: $latest_go_minor_version)"

# Resolve repo root (script is in scripts/ under repo root)
REPO_ROOT=$(cd "$(dirname "$0")/.."; pwd)
cd "$REPO_ROOT"

# Get the required Go version from go.mod
required_go_version=$(awk '/^go [0-9]/{print $2; exit}' go.mod)
echo "Required Go version in go.mod: $required_go_version"

# Helper for version comparison (checks if $1 >= $2 using natural sort)
version_ge() {
first=$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -n1)
[ "$first" = "$2" ]
}

if [ "$required_go_version" != "$latest_go_minor_version" ]; then
echo -e "${YELLOW}New Go version available: $latest_go_minor_version${NC}"
echo -e "${YELLOW}Current project requires: $required_go_version${NC}"
echo -e "${YELLOW}Updating project files to use Go $latest_go_minor_version...${NC}"

files_updated=()

# Update go.mod 'go X.Y' directive
if sed -i -E "s/^go [0-9]+\.[0-9]+/go ${latest_go_minor_version}/" go.mod; then
files_updated+=("go.mod")
fi

# Update GitHub Actions workflows go-version
if [ -d .github/workflows ]; then
while IFS= read -r -d '' wf; do
# Replace go-version: "X.Y" or X.Y[.Z]
sed -i -E "s/(go-version:\s*[\"']?)[0-9]+\.[0-9]+(\.[0-9]+)?([\"']?)/\1${latest_go_minor_version}\3/" "$wf"
files_updated+=("$wf")
done < <(find .github/workflows -type f \( -name "*.yml" -o -name "*.yaml" \) -print0 2>/dev/null)
fi

# Update Dockerfiles (ARG GO_VERSION= and any 'golang:X.Y[.Z]' literals)
if [ -d build ]; then
while IFS= read -r -d '' df; do
sed -i -E "s/^(ARG GO_VERSION=)[0-9]+\.[0-9]+(\.[0-9]+)?/\1${latest_go_minor_version}/" "$df"
sed -i -E "s/(golang:)[0-9]+\.[0-9]+(\.[0-9]+)?/\1${latest_go_minor_version}/" "$df"
files_updated+=("$df")
done < <(find build -type f -name "Dockerfile*" -print0 2>/dev/null)
fi

echo -e "${GREEN}Updated files:"${NC}
for f in "${files_updated[@]}"; do
echo " - $f"
done
fi

echo -e "${GREEN}Go version check completed${NC}"

echo -e "\n${YELLOW}Updating Go dependencies...${NC}"

# Only run dependency updates if local Go toolchain is compatible
local_go_version=$(go version 2>/dev/null | awk '{print $3}' | sed 's/^go//' || true)
local_go_minor_version=$(echo "$local_go_version" | cut -d. -f1-2)

if [ -z "$local_go_version" ]; then
echo -e "${RED}Go toolchain not found in PATH. Skipping dependency updates.${NC}"
exit 1
fi

if ! version_ge "$local_go_minor_version" "$latest_go_minor_version"; then
echo -e "${YELLOW}Local Go version ($local_go_version) is older than target ($latest_go_minor_version). Skipping dependency updates.${NC}"
echo -e "${YELLOW}Please upgrade your local Go toolchain and re-run this script to update dependencies.${NC}"
exit 1
fi

# Update all direct dependencies
echo "Running go get -u ./..."
go get -u ./...

# Update all indirect dependencies
echo "Running go get -u -t ./..."
go get -u -t ./...

# Tidy up the dependencies
echo "Running go mod tidy..."
go mod tidy

# Verify the dependencies
echo "Running go mod verify..."
go mod verify

echo -e "${GREEN}Dependencies updated successfully!${NC}"

Loading