chore(build): bump Go toolchain to 1.27.0

Go 1.27.0 shipped on 2026-08-19. Raise the go directive and the builder
image so Docker and release builds pick it up; every CI job already reads
the version from go.mod, and golangci-lint v2.13.1 release binaries are
themselves built with go1.27.0, so the lint job needs no pin change.
This commit is contained in:
Sanaei
2026-08-23 21:51:39 +02:00
parent 02002dc1c3
commit 81fcacab11
20 changed files with 48 additions and 56 deletions
@@ -7,10 +7,6 @@ import (
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
func externalLinkBool(v bool) *bool {
return &v
}
func TestSetExternalLinksPersistsEnableState(t *testing.T) {
setupBulkDB(t)
db := database.GetDB()
@@ -22,8 +18,8 @@ func TestSetExternalLinksPersistsEnableState(t *testing.T) {
}
if err := svc.SetExternalLinksForRecord(rec.Id, []ExternalLinkInput{
{Kind: model.ExternalLinkKindLink, Value: "trojan://pw@example.com:443#on", Remark: "Primary", Enable: externalLinkBool(true), ExpiryTime: 1767225600000},
{Kind: model.ExternalLinkKindSubscription, Value: "https://provider.example/sub", Remark: "Provider", Enable: externalLinkBool(false), NamePrefix: "[zjh] "},
{Kind: model.ExternalLinkKindLink, Value: "trojan://pw@example.com:443#on", Remark: "Primary", Enable: new(true), ExpiryTime: 1767225600000},
{Kind: model.ExternalLinkKindSubscription, Value: "https://provider.example/sub", Remark: "Provider", Enable: new(false), NamePrefix: "[zjh] "},
{Kind: model.ExternalLinkKindLink, Value: "trojan://pw@example.net:443#default"},
}); err != nil {
t.Fatalf("set external links: %v", err)
@@ -76,7 +72,7 @@ func TestSetExternalLinksPreservesFetchStatus(t *testing.T) {
}
if err := svc.SetExternalLinksForRecord(rec.Id, []ExternalLinkInput{
{Kind: row.Kind, Value: row.Value, Remark: "new", Enable: externalLinkBool(true)},
{Kind: row.Kind, Value: row.Value, Remark: "new", Enable: new(true)},
}); err != nil {
t.Fatalf("set external links: %v", err)
}
+5 -6
View File
@@ -4,15 +4,14 @@ import (
"encoding/json"
"testing"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
"github.com/mhsanaei/3x-ui/v3/internal/xray"
)
func TestClientWithAttachmentsMarshalJSONIncludesExtras(t *testing.T) {
c := ClientWithAttachments{
ClientRecord: model.ClientRecord{Id: 1, Email: "alice@example.com"},
InboundIds: []int{3, 5},
Traffic: &xray.ClientTraffic{Email: "alice@example.com", Up: 1024, Down: 4096, Enable: true},
Id: 1, Email: "alice@example.com",
InboundIds: []int{3, 5},
Traffic: &xray.ClientTraffic{Email: "alice@example.com", Up: 1024, Down: 4096, Enable: true},
}
out, err := json.Marshal(c)
if err != nil {
@@ -39,8 +38,8 @@ func TestClientWithAttachmentsMarshalJSONIncludesExtras(t *testing.T) {
func TestClientWithAttachmentsMarshalJSONOmitsAbsentTraffic(t *testing.T) {
c := ClientWithAttachments{
ClientRecord: model.ClientRecord{Id: 1, Email: "bob@example.com"},
InboundIds: nil,
Id: 1, Email: "bob@example.com",
InboundIds: nil,
}
out, err := json.Marshal(c)
if err != nil {
@@ -118,7 +118,7 @@ func TestAutoRenewClients_CalendarModeClampsShortMonths(t *testing.T) {
func firstBillingMidnightAfter(t *testing.T, from time.Time, day int, loc *time.Location) time.Time {
t.Helper()
cur := time.Date(from.Year(), from.Month(), from.Day(), 0, 0, 0, 0, loc)
for i := 0; i < 400; i++ {
for range 400 {
cur = cur.AddDate(0, 0, 1)
want := day
if last := time.Date(cur.Year(), cur.Month()+1, 0, 0, 0, 0, 0, loc).Day(); want > last {
+1 -1
View File
@@ -187,7 +187,7 @@ func TestEnsureMasterClientCertConcurrentFirstUseMintsOneCredential(t *testing.T
}
close(start)
var first crypto.CertKeyPEM
for i := 0; i < callers; i++ {
for i := range callers {
credential := <-results
if err := <-errs; err != nil {
t.Fatalf("caller %d: %v", i, err)