Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到Go web服务器404页面_Go_Webserver_Webassembly - Fatal编程技术网

找不到Go web服务器404页面

找不到Go web服务器404页面,go,webserver,webassembly,Go,Webserver,Webassembly,我不熟悉web组装 我写了一个web.go到服务器index.htmlwasm\u exec.jsmain.wasm目录下Hello\u WebAssembly 然后我在终端中运行web.go 然后我转到localhost:8080,它报告404未找到页面 我正在按照说明https://github.com/golang/go/wiki/WebAssembly 这是我的web.gocode package main import ( "log" "net/http" ) fu

我不熟悉web组装

我写了一个
web.go
到服务器
index.html
wasm\u exec.js
main.wasm
目录下
Hello\u WebAssembly

然后我在终端中运行web.go

然后我转到localhost:8080,它报告
404未找到页面

我正在按照说明
https://github.com/golang/go/wiki/WebAssembly

这是我的
web.go
code

package main

import (
    "log"
    "net/http"
)

func main() {
    fs := http.FileServer(http.Dir("Hello_WebAssembly"))
    http.Handle("/", fs)

    log.Println("Listening...")
    http.ListenAndServe(":8080", nil)
}
我不知道为什么

希望有人能帮我

提前谢谢


顺便说一下,我的操作系统是win10

我假定您的项目名为
Hello\u WebAssembly
,您正在文件夹中运行
go run
命令

如果是这种情况,那么您的
http.Dir
调用应该是
http.Dir(“.”
,因为您希望为当前目录(项目)中的资源提供服务