更新1.1麻烦,无法在文件夹中运行Go文件和JSON文件

Update 1.1

After receiving helpful feedback about changing the handler path I used that feedback in my application, but weirdly enough I am still receiving some error feed. I am trying to figure it out by myself, but I thought I might share it with you guys. This is also the reason why I canceled the answer that was given right now. Also some answers were to confusing for me right now to understand how that was going to work for me.

package main

import (

    "net/http" // Package http provides HTTP client and server implementations.



)

func main(){
    webHost()

}


func webHost(){
    // Ik heb hier later nog een mapje voor de html pagina's toegevoegd. 
    http.Handle("/go", http.FileServer(http.Dir("./1_Go_Files"))) 
    http.Handle("/html", http.FileServer(http.Dir("./2_Html_Pages"))) 
    http.Handle("/storage", http.FileServer(http.Dir("./3_Json_Storage"))) 
    // -----------------------------------------------------------------

    http.HandleFunc("/homepage", Homehandler) 
    http.HandleFunc("/selectiepagina", Selectiehandler) 
    http.HandleFunc("/userinputpagina", Userinputhandler) 
    http.HandleFunc("/bestelnrpagina", Bestelnrhandler)
    http.HandleFunc("/statuspagina", Statushandler)  




    //FileServer returns a handler that serves HTTP requests with the contents of the file system rooted at root..

    http.Handle("/4_Css_Styling/", http.StripPrefix("/4_Css_Styling/", http.FileServer(http.Dir("css")))) // css styling map.
    http.Handle("/5_Pizza_Img/", http.StripPrefix("/5_Pizza_Img/", http.FileServer(http.Dir("img")))) // image mapje.


}

So here the new panic (sorry for the wall of text, I wasn't sure what to leave out so I just copy pasted everything here:

   2018/11/12 10:07:11 http: panic serving [::1]:58084: runtime error: invalid memory address or nil pointer dereference
    goroutine 4 [running]:
    net/http.(*conn).serve.func1(0xc0000de000)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc0001160e0, 0x71ac40, 0x7f5300, 0xc000106120, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc0001160e0, 0xc000124000)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc0001160e0, 0xc000124000)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc0001160e0, 0xc000124000)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc0001160e0, 0xc000124000)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc0000de000, 0x7fa120, 0xc0000320c0)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:11 http: panic serving [::1]:58087: runtime error: invalid memory address or nil pointer dereference
    goroutine 19 [running]:
    net/http.(*conn).serve.func1(0xc00004cf00)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc0001161c0, 0x71ac40, 0x7f5300, 0xc0001061e0, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc0001161c0, 0xc000126000)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc0001161c0, 0xc000126000)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc0001161c0, 0xc000126000)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc0001161c0, 0xc000126000)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc00004cf00, 0x7fa120, 0xc00004e240)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:11 http: panic serving [::1]:58088: runtime error: invalid memory address or nil pointer dereference
    goroutine 37 [running]:
    net/http.(*conn).serve.func1(0xc000172000)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc0001162a0, 0x71ac40, 0x7f5300, 0xc000106360, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc0001162a0, 0xc000124100)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc0001162a0, 0xc000124100)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc0001162a0, 0xc000124100)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc0001162a0, 0xc000124100)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc000172000, 0x7fa120, 0xc000110240)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:11 http: panic serving [::1]:58089: runtime error: invalid memory address or nil pointer dereference
    goroutine 39 [running]:
    net/http.(*conn).serve.func1(0xc0001720a0)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc000116380, 0x71ac40, 0x7f5300, 0xc0001064e0, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc000116380, 0xc000124200)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc000116380, 0xc000124200)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc000116380, 0xc000124200)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc000116380, 0xc000124200)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc0001720a0, 0x7fa120, 0xc000110340)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:12 http: panic serving [::1]:58090: runtime error: invalid memory address or nil pointer dereference
    goroutine 20 [running]:
    net/http.(*conn).serve.func1(0xc00004cfa0)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc000116460, 0x71ac40, 0x7f5300, 0xc000106660, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc000116460, 0xc000126100)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc000116460, 0xc000126100)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc000116460, 0xc000126100)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc000116460, 0xc000126100)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc00004cfa0, 0x7fa120, 0xc00004e2c0)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:12 http: panic serving [::1]:58091: runtime error: invalid memory address or nil pointer dereference
    goroutine 41 [running]:
    net/http.(*conn).serve.func1(0xc000172140)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc0001cc000, 0x71ac40, 0x7f5300, 0xc000067290, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc0001cc000, 0xc000124300)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc0001cc000, 0xc000124300)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc0001cc000, 0xc000124300)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc0001cc000, 0xc000124300)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc000172140, 0x7fa120, 0xc000110440)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc
    2018/11/12 10:07:12 http: panic serving [::1]:58092: runtime error: invalid memory address or nil pointer dereference
    goroutine 22 [running]:
    net/http.(*conn).serve.func1(0xc00004d040)
            C:/tools/go/src/net/http/server.go:1746 +0xd7
    panic(0x73a9c0, 0xa34b30)
            C:/tools/go/src/runtime/panic.go:513 +0x1c7
    html/template.(*Template).escape(0x0, 0x0, 0x0)
            C:/tools/go/src/html/template/template.go:95 +0x35
    html/template.(*Template).Execute(0x0, 0x7f7580, 0xc0001cc0e0, 0x71ac40, 0x7f5300, 0xc000067410, 0x3)
            C:/tools/go/src/html/template/template.go:119 +0x36
    main.Homehandler(0x7f9f60, 0xc0001cc0e0, 0xc000126200)
            C:/Users/Taavetti/Documents/Go/Sources/src/Projects/VillaBrutus_Main/1_Go_Files/0_Homepagina.go:14 +0xc8
    net/http.HandlerFunc.ServeHTTP(0x7b3ca8, 0x7f9f60, 0xc0001cc0e0, 0xc000126200)
            C:/tools/go/src/net/http/server.go:1964 +0x4b
    net/http.(*ServeMux).ServeHTTP(0xa438e0, 0x7f9f60, 0xc0001cc0e0, 0xc000126200)
            C:/tools/go/src/net/http/server.go:2361 +0x12e
    net/http.serverHandler.ServeHTTP(0xc00004b040, 0x7f9f60, 0xc0001cc0e0, 0xc000126200)
            C:/tools/go/src/net/http/server.go:2741 +0xb2
    net/http.(*conn).serve(0xc00004d040, 0x7fa120, 0xc00004e3c0)
            C:/tools/go/src/net/http/server.go:1847 +0x64d
    created by net/http.(*Server).Serve
            C:/tools/go/src/net/http/server.go:2851 +0x2fc

Again I am still trying to figure this out by myself, since I want to show I am also putting effort into this and not just trying to get all the answers out of you. But it would be helpful if you could help me into the right direction.

(Also again I am a new user, if I am breaking some rules in this thread please notify me after you've down-voted this threat, I really enjoy stackoverflow and I am trying to learn how this community works.)

VillaBrutus_Main.zip

(Added my current application, including the error, maybe that helps?, be aware there are some dutch comments)

You have assigned / with multiple handlers. Take a look at your code twice:

func webHost(){
    http.Handle("/", 
    http.FileServer(http.Dir("./html_paginas"))) 
    http.Handle("/", http.FileServer(http.Dir("./go_files"))) 
    http.Handle("/", http.FileServer(http.Dir("./storage")))
    //...
}

So the http must have to panic in this situation. So the fixes for this are:

func webHost(){
    http.Handle("/html", 
    http.FileServer(http.Dir("./html_paginas"))) 
    http.Handle("/go", http.FileServer(http.Dir("./go_files"))) 
    http.Handle("/storage", 
    http.FileServer(http.Dir("./storage")))
    //...
}

Or:

func webHost(){
    http.Handle("/", http.FileServer(http.Dir("./root"))) 
    //...
}

Now move your html, go, storage directories to the root directory.

func (mux *ServeMux) Handle(pattern string, handler Handler) {
   mux.mu.Lock()
   defer mux.mu.Unlock()

   if pattern == "" {
       panic("http: invalid pattern")
   }
   if handler == nil {
       panic("http: nil handler")
   }
   if _, exist := mux.m[pattern]; exist {
       // PANIC HAPPEND HERE
       panic("http: multiple registrations for " + pattern)
   }

   if mux.m == nil {
       mux.m = make(map[string]muxEntry)
   }
   mux.m[pattern] = muxEntry{h: handler, pattern: pattern}

   if pattern[0] != '/' {
       mux.hosts = true
   }


}