在Golang TCP服务器中修剪换行符

I'm trying to figure out how to remove the new line in a golang string message that I've received from a netcat tcp message. I've used the string.TrimSpace function but I still can't seem to remove the newline. Any ideas? I've also tried to use the other trimming functions in the string package but couldn't get those to work either.

Could it be related to the error reading: EOF msg?

>>> go run newline_ex.go
Listening on localhost:8080
Error reading: EOF
received message: sometext|

post trim: sometext|


# Seperate terminal
>>> echo -n "sometext
" | nc localhost 8080  
package main

import (
    "bufio"
    "fmt"
    "net"
    "os"
    "strings"
)

const (
    host     = "localhost"
    port     = "8080"
    adress   = host + ":" + port
    connType = "tcp"
)

func handleMsg(message string) (string, error) {
    fmt.Printf("received message: %s
", message)
    m := strings.TrimSpace(message)
    fmt.Printf("post trim: %s 
", m)

    return "OK", nil
}

func handleRequest(conn net.Conn) {
    msg, err := bufio.NewReader(conn).ReadString('
')
    if err != nil {
        fmt.Println("Error reading:", err.Error())
    }

    response, err := handleMsg(msg)
    if err != nil {
        fmt.Printf("fail to handle message: %v
", err)
    }

    fmt.Printf("Sending response: %v
", response)
    conn.Write([]byte(response + "
"))
    conn.Close()
}

func main() {
    l, err := net.Listen(connType, adress)
    if err != nil {
        fmt.Printf("Error listening: %v", err)
        os.Exit(1)
    }
    defer l.Close()
    fmt.Println("Listening on " + adress)

    for {
        conn, err := l.Accept()
        if err != nil {
            fmt.Printf("Error accepting: %v
", err)
            os.Exit(1)
        }

        go handleRequest(conn)
    }
}

strings.Trimspace trims the leading and trailing whitespace. Use

strings.TrimRight("sometext
", "
")