I build a very simple web by using GO and HTML.
The hierarchy is like this…
root |--html
|--static---gambar
The folder of ‘html’ contains my html-code (sementara.html). The folder of ‘static’ contains the folder of ‘gambar’. And in the folder of ‘gambar’ contains the picture-file (gua.png).
===
sementara.html
<html>
<head>
<title>Show photo-list</title>
</head>
<style>
a {
text-decoration: none;
}
body {
font-family: Arial, Helvetica;
font-size: 12px;
}
</style>
<body><center>
<h1>Photo-List</h1>
<a href="imgsrcgua" style="text-decoration: none;"><img src="../static/gambar/gua.png" alt="I can not find the picture-file">Patrix Linus</a>
</center></body>
</html>


====
main.go
package main
import (
"fmt"
"html/template"
"log"
"net/http"
//"net/url"
//"os"
"strings"
)
func my_webLobby(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fmt.Println(r.Form)
fmt.Println("path", r.URL.Path)
fmt.Println("scheme", r.URL.Scheme)
fmt.Println(r.Form["url_long"])
for k, v := range r.Form {
fmt.Println("key:", k)
fmt.Println("val:", strings.Join(v, ""))
}
t, _ := template.ParseFiles("html/sementara.html")
t.Execute(w, nil)
}
func tampilkanimgsrc(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", 302)
}
func main() {
http.HandleFunc("/", my_webLobby)
http.HandleFunc("/imgsrcgua", tampilkanimgsrc)
err := http.ListenAndServe(":9099", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
=====
But my ‘sementara.html’ can not find the file of ‘gua.png’(a picture).
I don’t understand why. Please explain to me how actually GO manages about location of a file. Why my html can not find the file of picture (‘gua.png’) whereas it should be in .
Please somebody would be so nice expain this issue to me.