Docker中的Golang Hello World Web App返回404

I’m trying to run a simple “Hello world” Golang http app. It runs on port 6258. I’m running it in a Debian 9 Docker container. When I try to visit it in Chrome at localhost:6258 it’s just a blank page. I’ve spent hours trying to figure this out. Everything I’ve read indicates that this should work, yet it isn’t. I have no idea any more, but I'm clearly doing something wrong. Here is everything I’ve done:

I downloaded the latest Docker Debian 9 image with this command:

docker pull debian:latest

I created a Dockerfile to expose the port and set up the environment.

Dockerfile:

FROM debian:latest

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get -y install sudo coreutils less vim man wget curl procps ca-certificates gnupg software-properties-common unzip libssl-dev libpcre3-dev gcc make zlib1g-dev net-tools
RUN curl -O https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
RUN tar xvf go1.10.3.linux-amd64.tar.gz
RUN sudo chown -R root:root ./go
RUN sudo mv go /usr/local
RUN echo 'export GOPATH=$HOME/work' >> /etc/profile
RUN echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> /etc/profile
RUN mkdir -p $HOME/work/src/hello-world/test

EXPOSE 6258

I created an image using the Dockerfile by running this command:

docker build -t testuser/testname:testtag .

I made a container from that image by running this command:

docker run -p 6258:6258 -i -t 939e7900be22  /bin/bash

I ran this command to finish the Go installation (didn't seem to work if I included it in the Dockerfile):

source /etc/profile

I created the app itself (vim $HOME/work/src/hello-world/test/main.go):

main.go:

package main
import (
  "fmt"
  "net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
  fmt.Fprintf(w, "Hello World")
}
func main() {
  http.HandleFunc("/", helloWorld)
  http.ListenAndServe(":6258", nil)
}

I ran the app with:

go run src/hello-world/test/main.go

When I visit localhost:6258 in Chrome, instead of showing "Hello World", it's just a blank page. Chrome inspector shows it's 0 bytes and the console shows "Failed to load resource: the server responded with a status of 404 (Not Found)".

telnet can connect to localhost:6258. curling confirms the 404:

curl localhost:6258 --verbose
* Rebuilt URL to: localhost:6258/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 6258 (#0)
> GET / HTTP/1.1
> Host: localhost:6258
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Fri, 22 Jun 2018 19:44:11 GMT
< Accept-Ranges: bytes
< Content-Length: 0
<
* Connection #0 to host localhost left intact

I've spent hour Googling this, but haven't found anything helpful. I'm out of ideas. I'm not great with Docker and this is my first attempt at using Go, so I won't be surprised if I've missed something obvious. Any help/advice would be appreciated. Thanks!