fix: address review findings — dynamic version, deduplicate KILL, update README
All checks were successful
check / check (push) Successful in 1m3s
All checks were successful
check / check (push) Successful in 1m3s
This commit is contained in:
@@ -8,10 +8,29 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"sneak.berlin/go/neoirc/internal/globals"
|
||||
"sneak.berlin/go/neoirc/internal/service"
|
||||
"sneak.berlin/go/neoirc/pkg/irc"
|
||||
)
|
||||
|
||||
// versionString returns the server version for IRC
|
||||
// responses, falling back to "neoirc-dev" when globals
|
||||
// are not set (e.g. during tests).
|
||||
func versionString() string {
|
||||
name := globals.Appname
|
||||
ver := globals.Version
|
||||
|
||||
if name == "" {
|
||||
name = "neoirc"
|
||||
}
|
||||
|
||||
if ver == "" {
|
||||
ver = "dev"
|
||||
}
|
||||
|
||||
return name + "-" + ver
|
||||
}
|
||||
|
||||
// sendIRCError maps a service.IRCError to an IRC numeric
|
||||
// reply on the wire.
|
||||
func (c *Conn) sendIRCError(err error) {
|
||||
@@ -1384,7 +1403,7 @@ func (c *Conn) handleUserhost(
|
||||
func (c *Conn) handleVersion(ctx context.Context) {
|
||||
_ = ctx
|
||||
|
||||
version := "neoirc-0.1"
|
||||
version := versionString()
|
||||
|
||||
c.sendNumeric(
|
||||
irc.RplVersion,
|
||||
@@ -1426,7 +1445,7 @@ func (c *Conn) handleInfo(ctx context.Context) {
|
||||
|
||||
infoLines := []string{
|
||||
"neoirc — IRC semantics over HTTP",
|
||||
"Version: neoirc-0.1",
|
||||
"Version: " + versionString(),
|
||||
"Written in Go",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user