Go packages and project structure and github throwing error

Hi Team,

I am go confused about using packages and github thing in the below code.
Please help and explain me what I am doing wrong. I have shared the project structure in the image format and the entire code - two files ( main.go and data.go) in the respective project structure files.
The code is throwing me errors at the below line : romanNumerals not found…
Please correct the code and help me understand how to do it right.

package main

import (

func main() {
	// http package has methods for dealing with requests
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		urlPathElements := strings.Split(r.URL.Path, "/")
		// If request is GET with correct syntax
		if urlPathElements[1] == "roman_number" {
			number, _ := strconv.Atoi(strings.TrimSpace(urlPathElements[2]))
			if number == 0 || number > 10 {
				// If resource is not in the list, send Not Found status
				w.Write([]byte("404 - Not Found"))
			} else {
				fmt.Fprintf(w, "%q",
		} else {
			// For all other requests, tell that Client sent a bad request
			w.Write([]byte("400 - Bad request"))
	// Create a server and run it on 8000 port
	s := &http.Server{
		Addr:           ":8000",
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,


package romanNumerals

var Numerals = map[int]string{
	10: "X",
	9:  "IX",
	8:  "VIII",
	7:  "VII",
	6:  "VI",
	5:  "V",
	4:  "IV",
	3:  "III",
	2:  "II",
	1:  "I",

Hi! You need to import "github.com/sgarg2023/modulename/romanNumerals" where modulename should be lowercased and explains itself, not ROMANPROJ and of course create the module like: go mod init github.com/sgarg2023/romannums (only an example), so import github.com/sgarg2023/romannums/romanNumerals

@Metalymph I tried building using (romanproj ) itself, becuase it was lowercase in my vscode.
But, facing the below issue. Now, what to do? Please help and explain.
Note : for time being leave the module name just like that.

Well, first keep module’s name as short as possible (keeping its meaning). The line github.com/sgarg2023/golangprojectpractice/tree/master/romanproj have to be removed since you’re importing the module itself and not a real package. Remove line 11. Line 13 is correct and shall be not commented. When you create a module locally, you can refer to a package inside the module simply importing modulename/packagePath :slight_smile: . Every module could have more packages, also nested.