图像未显示在Golang上带有img的html上的文字

image didnt show when writing on html.

        i can display only image writing on main.go (parsefile).

       but writing on html image didnt show.

i tried html/template. it didnt work too.

code: _base.html

   <!DOCTYPE html>
    <html lang="en">`enter code here`
        <head>
            <title>{{ template "title" . }}</title>
        </head>
        <body>
            <section id="contents">
                {{ template "content" . }}
            </section>
            <footer id="footer">
                My Cool Guestbook 2000 © me forever
            </footer>
        </body>
    </html>

    code:(index.html)

    {{ define "title" }}Guestbook{{ end }}

    {{ define "content" }}
        <h1>Guestbook</h1>

        <p>Hello, and welcome to my guestbook, because it's 1997!</p>

        <ul class="guests">
            <li>...</li>
        </ul>
       <img src="image.png">
    {{ end }}

code:(main.go some part)

var index = template.Must(template.ParseFiles(
  "templates/_base.html",
  "templates/index.html",
))

func hello(w http.ResponseWriter, req *http.Request) {
  if err := index.Execute(w, nil); err != nil {
      http.Error(w, err.Error(), http.StatusInternalServerError)
  }
}

func main(){ etc...
web application work fine. but image didnt show

Open your web browser and see what's the request to that image resource is returning.

It's probably returning a 404 Not Found because it can't locate the file.

For example in Chrome that would be:

image resource chrome developer tools

Adding to Agis's answer:

Maybe you are registered handlers just for rendering templates, not for providing files such as image.

You can use http.FileServer to provide your images.