Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade go to 1.19 #1987

Merged
merged 3 commits into from
Aug 4, 2022
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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "setup go"
uses: "actions/setup-go@v2"
with:
go-version: "1.18"
go-version: "1.19"
- name: "install python3-pytest"
run: "sudo apt install -y python3-pytest"
- name: "make install"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## build ergo binary
FROM golang:1.18-alpine AS build-env
FROM golang:1.19-alpine AS build-env

RUN apk add -U --force-refresh --no-cache --purge --clean-protected -l -u make git

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ergochat/ergo

go 1.18
go 1.19

require (
code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48
Expand Down
2 changes: 1 addition & 1 deletion irc/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func (server *Server) Config() (config *Config) {
return server.config.Get()
return server.config.Load()
}

func (server *Server) ChannelRegistrationEnabled() bool {
Expand Down
5 changes: 3 additions & 2 deletions irc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"

Expand Down Expand Up @@ -66,7 +67,7 @@ type Server struct {
channels ChannelManager
channelRegistry ChannelRegistry
clients ClientManager
config utils.ConfigStore[Config]
config atomic.Pointer[Config]
configFilename string
connectionLimiter connection_limits.Limiter
ctime time.Time
Expand Down Expand Up @@ -707,7 +708,7 @@ func (server *Server) applyConfig(config *Config) (err error) {
config.Server.Cloaks.SetSecret(LoadCloakSecret(server.store))

// activate the new config
server.config.Set(config)
server.config.Store(config)

// load [dk]-lines, registered users and channels, etc.
if initial {
Expand Down
4 changes: 3 additions & 1 deletion irc/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

// Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
// It also implements the following extensions:
//
// 8BITMIME RFC 1652
// AUTH RFC 2554
// STARTTLS RFC 3207
//
// Additional extensions may be handled by clients.
//
// The smtp package is frozen and is not accepting new features.
// Some external packages provide more functionality. See:
//
// https://godoc.org/?q=smtp
// https://godoc.org/?q=smtp
package smtp

import (
Expand Down
13 changes: 7 additions & 6 deletions irc/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ func (socket *Socket) Write(data []byte) (err error) {
}

// BlockingWrite sends the given string out of Socket. Requirements:
// 1. MUST block until the message is sent
// 2. MUST bypass sendq (calls to BlockingWrite cannot, on their own, cause a sendq overflow)
// 3. MUST provide mutual exclusion for socket.conn.Write
// 4. MUST respect the same ordering guarantees as Write (i.e., if a call to Write that sends
// message m1 happens-before a call to BlockingWrite that sends message m2,
// m1 must be sent on the wire before m2
// 1. MUST block until the message is sent
// 2. MUST bypass sendq (calls to BlockingWrite cannot, on their own, cause a sendq overflow)
// 3. MUST provide mutual exclusion for socket.conn.Write
// 4. MUST respect the same ordering guarantees as Write (i.e., if a call to Write that sends
// message m1 happens-before a call to BlockingWrite that sends message m2,
// m1 must be sent on the wire before m2
//
// Callers MUST be writing to the client's socket from the client's own goroutine;
// other callers must use the nonblocking Write call instead. Otherwise, a client
// with a slow/unreliable connection risks stalling the progress of the system as a whole.
Expand Down
33 changes: 0 additions & 33 deletions irc/utils/config.go

This file was deleted.

2 changes: 1 addition & 1 deletion irc/utils/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func parseProxyLineV2(line []byte) (ip net.IP, err error) {
return ip, nil
}

/// WrappedConn is a net.Conn with some additional data stapled to it;
// / WrappedConn is a net.Conn with some additional data stapled to it;
// the proxied IP, if one was read via the PROXY protocol, and the listener
// configuration.
type WrappedConn struct {
Expand Down
7 changes: 5 additions & 2 deletions irc/utils/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ type MessagePair struct {
// SplitMessage represents a message that's been split for sending.
// Two possibilities:
// (a) Standard message that can be relayed on a single 512-byte line
// (MessagePair contains the message, Split == nil)
//
// (MessagePair contains the message, Split == nil)
//
// (b) multiline message that was split on the client side
// (Message == "", Split contains the split lines)
//
// (Message == "", Split contains the split lines)
type SplitMessage struct {
Message string
Msgid string
Expand Down