"crypto/subtle"
"encoding/hex"
"fmt"
- "io/ioutil"
"log"
"net"
+ "os"
"regexp"
"sort"
"strings"
c.ReplyNicknamed("422", "MOTD File is missing")
return
}
- motdText, err := ioutil.ReadFile(*motd)
+ motdText, err := os.ReadFile(*motd)
if err != nil {
log.Printf("can not read motd file %s: %v", *motd, err)
c.ReplyNicknamed("422", "Error reading MOTD File")
c.Close()
return
}
- contents, err := ioutil.ReadFile(*passwords)
+ contents, err := os.ReadFile(*passwords)
if err != nil {
log.Fatalf("can not read passwords file %s: %s", *passwords, err)
return
package main
import (
- "io/ioutil"
"os"
"strings"
"testing"
}
func TestMotd(t *testing.T) {
- fd, err := ioutil.TempFile("", "motd")
+ fd, err := os.CreateTemp("", "motd")
if err != nil {
t.Fatalf("can not create temporary file: %v", err)
}
import (
"crypto/tls"
"flag"
- "io/ioutil"
"log"
"net"
"os"
log.Fatalln("can not read statedir", err)
}
for _, state := range states {
- buf, err := ioutil.ReadFile(path.Join(state, StateTopicFilename))
+ buf, err := os.ReadFile(path.Join(state, StateTopicFilename))
if err != nil {
log.Fatalf(
"can not read state %s/%s: %v",
}
room := RoomRegister(path.Base(state))
room.topic = strings.TrimRight(string(buf), "\n")
- buf, err = ioutil.ReadFile(path.Join(state, StateKeyFilename))
+ buf, err = os.ReadFile(path.Join(state, StateKeyFilename))
if err == nil {
room.key = strings.TrimRight(string(buf), "\n")
} else {
}
topicPath := path.Join(statePath, StateTopicFilename)
- if err := ioutil.WriteFile(
+ if err := os.WriteFile(
topicPath,
[]byte(event.topic+"\n"),
permStateFile,
}
keyPath := path.Join(statePath, StateKeyFilename)
- if err := ioutil.WriteFile(
+ if err := os.WriteFile(
keyPath,
[]byte(event.key+"\n"),
permStateFile,