Update Go in actions and add go vet to pre-commit
This commit is contained in:
5
.github/workflows/go.yml
vendored
5
.github/workflows/go.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.18]
|
go-version: [1.19]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@@ -17,6 +17,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go-version }}
|
||||||
|
|
||||||
|
- name: Install libolm
|
||||||
|
run: sudo apt-get install libolm-dev libolm3
|
||||||
|
|
||||||
- name: Install goimports
|
- name: Install goimports
|
||||||
run: |
|
run: |
|
||||||
go install golang.org/x/tools/cmd/goimports@latest
|
go install golang.org/x/tools/cmd/goimports@latest
|
||||||
|
|||||||
@@ -12,3 +12,4 @@ repos:
|
|||||||
rev: v1.0.0-beta.5
|
rev: v1.0.0-beta.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: go-imports-repo
|
- id: go-imports-repo
|
||||||
|
- id: go-vet-repo-mod
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ func (mq *MessageQuery) scanAll(rows *sql.Rows, err error) []*Message {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
mq.log.Warnfln("Failed to query many messages: %v", err)
|
mq.log.Warnfln("Failed to query many messages: %v", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
return nil
|
|
||||||
} else if rows == nil {
|
} else if rows == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ func (up UserPortal) Scan(l log.Logger, row dbutil.Scannable) *UserPortal {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
l.Errorln("Error scanning user portal:", err)
|
l.Errorln("Error scanning user portal:", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
up.Timestamp = time.UnixMilli(ts)
|
up.Timestamp = time.UnixMilli(ts)
|
||||||
return &up
|
return &up
|
||||||
@@ -49,7 +48,6 @@ func (u *User) GetPortals() []UserPortal {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
u.log.Errorln("Failed to get portals:", err)
|
u.log.Errorln("Failed to get portals:", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return u.scanUserPortals(rows)
|
return u.scanUserPortals(rows)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ type astDiscordCustomEmoji struct {
|
|||||||
|
|
||||||
func (n *astDiscordCustomEmoji) String() string {
|
func (n *astDiscordCustomEmoji) String() string {
|
||||||
if n.animated {
|
if n.animated {
|
||||||
return fmt.Sprintf("<a%s%s>", n.name, n.id)
|
return fmt.Sprintf("<a%s%d>", n.name, n.id)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("<%s%s>", n.name, n.id)
|
return fmt.Sprintf("<%s%d>", n.name, n.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
type discordTagParser struct{}
|
type discordTagParser struct{}
|
||||||
|
|||||||
1
user.go
1
user.go
@@ -644,7 +644,6 @@ func (user *User) handleGuildRoles(guildID string, newRoles []*discordgo.Role) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
user.log.Errorln("Failed to start transaction for guild role sync:", err)
|
user.log.Errorln("Failed to start transaction for guild role sync:", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
for _, role := range newRoles {
|
for _, role := range newRoles {
|
||||||
dbRole, changed := user.discordRoleToDB(guildID, role, existingRoleMap[role.ID])
|
dbRole, changed := user.discordRoleToDB(guildID, role, existingRoleMap[role.ID])
|
||||||
|
|||||||
Reference in New Issue
Block a user