~samwhited/xmpp

7ec48f31d6cf2a22a445beb594eb195522671628 — Sam Whited 2 months ago e497bc2
all: remove use of deprecated ioutil

Signed-off-by: Sam Whited <sam@samwhited.com>
M examples/echobot/main.go => examples/echobot/main.go +1 -2
@@ 15,7 15,6 @@ import (
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"os/signal"


@@ 39,7 38,7 @@ func (lw logWriter) Write(p []byte) (int, error) {
func main() {
	// Setup logging and verbose logging that's disabled by default.
	logger := log.New(os.Stderr, "", log.LstdFlags)
	debug := log.New(ioutil.Discard, "DEBUG ", log.LstdFlags)
	debug := log.New(io.Discard, "DEBUG ", log.LstdFlags)

	// Configure behavior based on flags and environment variables.
	var (

M examples/im/main.go => examples/im/main.go +5 -5
@@ 15,7 15,7 @@ import (
	"encoding/xml"
	"flag"
	"fmt"
	"io/ioutil"
	"io"
	"log"
	"os"
	"strings"


@@ 57,9 57,9 @@ type messageBody struct {

func main() {
	logger := log.New(os.Stderr, "", log.LstdFlags)
	debug := log.New(ioutil.Discard, "DEBUG ", log.LstdFlags)
	sentXML := log.New(ioutil.Discard, "SENT ", log.LstdFlags)
	recvXML := log.New(ioutil.Discard, "RECV ", log.LstdFlags)
	debug := log.New(io.Discard, "DEBUG ", log.LstdFlags)
	sentXML := log.New(io.Discard, "SENT ", log.LstdFlags)
	recvXML := log.New(io.Discard, "RECV ", log.LstdFlags)

	// Get and parse the XMPP address to send from.
	addr := os.Getenv(envAddr)


@@ 250,7 250,7 @@ func main() {
	}

	if rawMsg == "" {
		rawMsgBuf, err := ioutil.ReadAll(os.Stdin)
		rawMsgBuf, err := io.ReadAll(os.Stdin)
		if err != nil {
			logger.Fatalf("error reading message from stdin: %v", err)
		}

M internal/integration/integration.go => internal/integration/integration.go +1 -2
@@ 77,7 77,6 @@ import (
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"math/big"
	"net"
	"os"


@@ 149,7 148,7 @@ func New(ctx context.Context, name string, opts ...Option) (*Cmd, error) {
	if err != nil {
		return nil, err
	}
	cmd.cfgDir, err = ioutil.TempDir("", filepath.Base(cmd.name))
	cmd.cfgDir, err = os.MkdirTemp("", filepath.Base(cmd.name))
	if err != nil {
		return nil, err
	}

M internal/integration/mcabber/mcabber.go => internal/integration/mcabber/mcabber.go +1 -2
@@ 10,7 10,6 @@ import (
	"context"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"


@@ 124,7 123,7 @@ func defaultConfig(cmd *integration.Cmd) error {
			for {
				// Continue copying the rest of the stream directly into the output
				// file.
				_, err := io.Copy(ioutil.Discard, tr)
				_, err := io.Copy(io.Discard, tr)
				if err != nil {
					return
				}

M internal/xmpptest/session.go => internal/xmpptest/session.go +1 -2
@@ 8,7 8,6 @@ package xmpptest // import "mellium.im/xmpp/internal/xmpptest"
import (
	"context"
	"io"
	"io/ioutil"
	"net"
	"strings"



@@ 37,7 36,7 @@ func NopNegotiator(state xmpp.SessionState) xmpp.Negotiator {
			io.Reader
			io.Writer
		}{
			Writer: ioutil.Discard,
			Writer: io.Discard,
		}, out, s.State()&xmpp.S2S == xmpp.S2S, false, stream.DefaultVersion, "", "example.net", "test@example.net", "123")

		return state | xmpp.Ready, nil, nil, err