Skip to content

Commit

Permalink
build: update Go version to 1.22.x and update dependencies- Update Go…
Browse files Browse the repository at this point in the history
… version matrix to use1.22.x in GitHub Actions workflows.

- Disable CGO and remove 32-bit compiler installations for Linux and macOS
  as they are no longer needed with the new Go version.- Update go-sql-driver/mysql, google/uuid, zap, and other dependencies to
  their latest compatible versions.
- Refactor import statements in console commands and database module to
  ensure consistency and remove unused imports.
- Add new requirements to go.mod for updated dependencies.

BREAKING CHANGE: This commit drops support for 32-bit architectures on
Linux and macOS builds due to the removal of CGO_ENABLED=1 and related
32-bit compiler installations. This change aligns with the updated Go version
and its improved support for64-bit architectures.
  • Loading branch information
godcong committed Jun 27, 2024
1 parent 5a1e726 commit 5582668
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 59 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.22.x]
platform: [ubuntu-latest]
arch: [386, amd64]
runs-on: ${{ matrix.platform }}
Expand All @@ -34,7 +34,6 @@ jobs:
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
Expand All @@ -52,11 +51,6 @@ jobs:
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
sudo apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu
export AR="/usr/bin/i686-linux-gnu-ar -m32"
export CXX="/usr/bin/i686-linux-gnu-cpp -m32"
export CC="/usr/bin/i686-linux-gnu-gcc -m32"
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.22.x]
platform: [macos-latest]
arch: [386, amd64]
runs-on: ${{ matrix.platform }}
Expand All @@ -34,7 +34,6 @@ jobs:
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
Expand All @@ -52,11 +51,6 @@ jobs:
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
sudo apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu
export AR="/usr/bin/i686-linux-gnu-ar -m32"
export CXX="/usr/bin/i686-linux-gnu-cpp -m32"
export CC="/usr/bin/i686-linux-gnu-gcc -m32"
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.22.x]
platform: [windows-latest]
arch: [386, amd64]
runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -43,7 +43,6 @@ jobs:
run: |
go mod tidy
set GOARCH=${{ matrix.arch }}
set CGO_ENABLED=1
echo "FATENAME=fate_windows_amd64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "building"
go build -o fate_windows_amd64.exe -v ./cmd/console
Expand All @@ -59,7 +58,6 @@ jobs:
run: |
go mod tidy
set GOARCH=${{ matrix.arch }}
set CGO_ENABLED=1
echo "FATENAME=fate_windows_386" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "building"
go build -o fate_windows_386.exe -v ./cmd/console
Expand Down
5 changes: 3 additions & 2 deletions cmd/console/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package main
import (
"errors"
"fmt"
"github.com/goextension/log"
"github.com/spf13/cobra"
"os"
"path/filepath"
"runtime"

"github.com/goextension/log"
"github.com/spf13/cobra"
)

func cmdCheck() *cobra.Command {
Expand Down
6 changes: 4 additions & 2 deletions cmd/console/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package main

import (
"fmt"
"github.com/babyname/fate/config"
"path/filepath"

"github.com/goextension/log"
"github.com/spf13/cobra"
"path/filepath"

"github.com/babyname/fate/config"
)

func cmdInit() *cobra.Command {
Expand Down
7 changes: 5 additions & 2 deletions cmd/console/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package main

import "fmt"
import "github.com/spf13/cobra"
import (
"fmt"

"github.com/spf13/cobra"
)

const programName = `fate`
const fateVersion = `0.0.2`
Expand Down
5 changes: 3 additions & 2 deletions cmd/console/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"path/filepath"
"time"

"github.com/babyname/fate"
"github.com/babyname/fate/config"
"github.com/godcong/chronos"
"github.com/goextension/log"
"github.com/spf13/cobra"

"github.com/babyname/fate"
"github.com/babyname/fate/config"
)

func cmdName() *cobra.Command {
Expand Down
4 changes: 3 additions & 1 deletion cmd/console/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package main

import (
"fmt"
"github.com/babyname/fate"

"github.com/spf13/cobra"

"github.com/babyname/fate"
)

func versionCMD() *cobra.Command {
Expand Down
5 changes: 2 additions & 3 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (

"github.com/go-sql-driver/mysql"
"github.com/goextension/log"
"github.com/mattn/go-sqlite3"
"github.com/sqlite3ent/sqlite3"
"github.com/xormsharp/xorm"

"github.com/babyname/fate/config"

"github.com/xormsharp/xorm"
)

const mysqlSource = "%s:%s@tcp(%s)/%s?loc=%s&charset=utf8mb4&parseTime=true"
Expand Down
41 changes: 34 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
module github.com/babyname/fate

require (
github.com/go-sql-driver/mysql v1.7.1
github.com/go-sql-driver/mysql v1.8.1
github.com/godcong/chronos v1.0.0
github.com/godcong/yi v1.0.2
github.com/goextension/log v0.0.2
github.com/google/uuid v1.3.0
github.com/mattn/go-sqlite3 v1.14.17
github.com/rakyll/statik v0.1.6
github.com/spf13/cobra v1.7.0
github.com/google/uuid v1.6.0
github.com/rakyll/statik v0.1.7
github.com/spf13/cobra v1.8.1
github.com/sqlite3ent/sqlite3 v1.1.1
github.com/xormsharp/builder v0.3.8
github.com/xormsharp/xorm v1.0.4
go.uber.org/zap v1.24.0
go.uber.org/zap v1.27.0
)

go 1.16
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.21.0 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.53.4 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.30.1 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)

go 1.22

toolchain go1.22.4
Loading

0 comments on commit 5582668

Please sign in to comment.