Skip to content

Commit

Permalink
refactor(go): bump the module version and support go install (#979)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The original Go module name was `github.com/ArtalkJS/Artalk`, which has now been modified to `github.com/artalkjs/artalk/v2` (all lowercase). This change may affect the CI pipeline or other areas if you are compiling the Artalk server and have specified the fixed Go module name. Regarding the original `-ldflags -X github.com/ArtalkJS/Artalk/internal/config.Version` and `CommitHash` definitions, please remove them, as they are now obsolete. The `Version` has been hardcoded into the Go code, and the `CommitHash` is now read from the Go build info via runtime/debug’s vcs.revision value. This change only affects the server developers and does not impact the frontend UI client.
  • Loading branch information
qwqcode committed Sep 18, 2024
1 parent 9cc3252 commit cf7725e
Show file tree
Hide file tree
Showing 190 changed files with 481 additions and 482 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:

env:
GO_VERSION: 1.22.6
PKG_NAME: github.com/ArtalkJS/Artalk
DOCKER_IMG: ghcr.io/goreleaser/goreleaser-cross
CACHE_DIR: /tmp/cache/docker-image

Expand Down Expand Up @@ -78,8 +77,8 @@ jobs:
--privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/sysroot:/sysroot \
-v $(pwd):/go/src/${PKG_NAME} \
-w /go/src/${PKG_NAME} \
-v $(pwd):/repo \
-w /repo \
-e CGO_ENABLED=1 \
--env-file local/.release-env \
ghcr.io/goreleaser/goreleaser-cross:v${GO_VERSION} \
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ builds:
binary: "{{.ProjectName}}"
main: ./main.go
ldflags: &common_ldflags |
-X github.com/ArtalkJS/Artalk/internal/config.Version={{.Version}}
-X github.com/ArtalkJS/Artalk/internal/config.CommitHash={{ .ShortCommit }}
-X github.com/artalkjs/artalk/v2/internal/config.Version={{.Version}}
-X github.com/artalkjs/artalk/v2/internal/config.CommitHash={{ .ShortCommit }}
-s -w

# Linux (arm_64)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG_NAME := github.com/ArtalkJS/Artalk
PKG_NAME := github.com/artalkjs/artalk/v2
BIN_NAME := ./bin/artalk
VERSION ?= $(shell git describe --tags --abbrev=0 --match 'v*')
COMMIT_HASH ?= $(shell git rev-parse --short HEAD)
Expand Down
8 changes: 4 additions & 4 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"strings"
"syscall"

"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/artalkjs/artalk/v2/internal/utils"
"github.com/spf13/cobra"
"golang.org/x/term"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os/signal"
"syscall"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/ArtalkJS/Artalk/internal/core"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/artalkjs/artalk/v2/internal/core"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"path/filepath"
"time"

"github.com/ArtalkJS/Artalk/internal/artransfer"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/artransfer"
"github.com/artalkjs/artalk/v2/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/artalkjs/artalk/v2/internal/utils"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/gen.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/ArtalkJS/Artalk/internal/core"
"github.com/artalkjs/artalk/v2/internal/core"
"github.com/spf13/cobra"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"errors"
"os"

"github.com/ArtalkJS/Artalk/internal/artransfer"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/artransfer"
"github.com/artalkjs/artalk/v2/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cmd
import (
"fmt"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/ArtalkJS/Artalk/server"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/artalkjs/artalk/v2/server"

"github.com/spf13/cobra"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"strings"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/artalkjs/artalk/v2/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/blang/semver"
"github.com/rhysd/go-github-selfupdate/selfupdate"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ArtalkJS/Artalk
module github.com/artalkjs/artalk/v2

go 1.22.6

Expand Down
2 changes: 1 addition & 1 deletion internal/anti_spam/akismet.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"strings"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/log"
)

var _ Checker = (*AkismetChecker)(nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/anti_spam/aliyun.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package anti_spam
import (
"fmt"

"github.com/ArtalkJS/Artalk/internal/cloud/aliyun"
"github.com/artalkjs/artalk/v2/internal/cloud/aliyun"
)

var _ Checker = (*AliyunChecker)(nil)
Expand Down
4 changes: 2 additions & 2 deletions internal/anti_spam/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strconv"
"strings"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/samber/lo"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/anti_spam/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/samber/lo"
"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/anti_spam/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"sync"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/artalkjs/artalk/v2/internal/utils"
)

var _ Checker = (*KeywordsChecker)(nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/anti_spam/tencent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package anti_spam
import (
"fmt"

"github.com/ArtalkJS/Artalk/internal/cloud/qcloud"
"github.com/artalkjs/artalk/v2/internal/cloud/qcloud"
)

var _ Checker = (*TencentChecker)(nil)
Expand Down
6 changes: 3 additions & 3 deletions internal/artransfer/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package artransfer
import (
"fmt"

"github.com/ArtalkJS/Artalk/internal/dao"
"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/dao"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/internal/i18n"
"gorm.io/gorm"
)

Expand Down
8 changes: 4 additions & 4 deletions internal/artransfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"regexp"
"testing"

"github.com/ArtalkJS/Artalk/internal/dao"
"github.com/ArtalkJS/Artalk/internal/db"
"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/test"
"github.com/artalkjs/artalk/v2/internal/dao"
"github.com/artalkjs/artalk/v2/internal/db"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/artransfer/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"strings"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/jedib0t/go-pretty/v6/table"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/artransfer/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package artransfer
import (
"encoding/json"

"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/internal/utils"
"gorm.io/gorm"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/artransfer/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"
"time"

"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/internal/i18n"
"github.com/artalkjs/artalk/v2/internal/utils"
"github.com/cheggaaa/pb/v3"
"github.com/samber/lo"
"gorm.io/gorm"
Expand Down
2 changes: 1 addition & 1 deletion internal/artransfer/importer_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package artransfer

import (
"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/artalkjs/artalk/v2/internal/entity"
"gorm.io/gorm"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/artransfer/importer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strings"
"testing"

"github.com/ArtalkJS/Artalk/internal/dao"
"github.com/ArtalkJS/Artalk/internal/db"
"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/artalkjs/artalk/v2/internal/dao"
"github.com/artalkjs/artalk/v2/internal/db"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/artransfer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"regexp"
"time"

"github.com/ArtalkJS/Artalk/internal/i18n"
"github.com/araddon/dateparse"
"github.com/artalkjs/artalk/v2/internal/i18n"
)

func readJsonFile(filename string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package auth
import (
"strings"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/markbates/goth"
"golang.org/x/text/cases"
"golang.org/x/text/language"
Expand Down
4 changes: 2 additions & 2 deletions internal/auth/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/url"
"strings"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/markbates/goth"
"github.com/markbates/goth/providers/apple"
"github.com/markbates/goth/providers/auth0"
Expand Down
6 changes: 3 additions & 3 deletions internal/auth/social_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"time"

"github.com/ArtalkJS/Artalk/internal/dao"
"github.com/ArtalkJS/Artalk/internal/entity"
"github.com/ArtalkJS/Artalk/internal/utils"
"github.com/artalkjs/artalk/v2/internal/dao"
"github.com/artalkjs/artalk/v2/internal/entity"
"github.com/artalkjs/artalk/v2/internal/utils"
)

func RegisterSocialUser(dao *dao.Dao, u SocialUser) (entity.AuthIdentity, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"reflect"

"github.com/ArtalkJS/Artalk/internal/log"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/eko/gocache/lib/v4/store"
"golang.org/x/sync/singleflight"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync/atomic"
"testing"

"github.com/ArtalkJS/Artalk/internal/cache"
"github.com/artalkjs/artalk/v2/internal/cache"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/cache/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strings"
"time"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/ArtalkJS/Artalk/internal/log"
"github.com/allegro/bigcache/v3"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/artalkjs/artalk/v2/internal/log"
"github.com/bradfitz/gomemcache/memcache"
lib_cache "github.com/eko/gocache/lib/v4/cache"
"github.com/eko/gocache/lib/v4/marshaler"
Expand Down
4 changes: 2 additions & 2 deletions internal/cache/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cache_test
import (
"testing"

"github.com/ArtalkJS/Artalk/internal/cache"
"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/cache"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/captcha/checker.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package captcha

import (
"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/config"
)

type Map = map[string]interface{}
Expand Down
2 changes: 1 addition & 1 deletion internal/captcha/checker_geetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"
"time"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/tidwall/gjson"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/captcha/checker_hcaptcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"time"

"github.com/ArtalkJS/Artalk/internal/config"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/tidwall/gjson"
)

Expand Down
Loading

0 comments on commit cf7725e

Please sign in to comment.