Undefined Error in Golang

I have the following structure:

/*gotime.go*/
package gotime

type Now struct {
    dnow int
    ynow int
    mnow time.Month
}

And is there a function like:

/*gotime.go*/
func (n Now) DayNow() int {
    n.dnow = time.Now().Day()
    return n.dnow

}

I’m getting the following error when I want to call this package:

/*main.go*/
package main

import (
    "fmt"
    "./gotime"
)

blah := Now
fmt.Println(blah.DayNow())

I get errors:

# command-line-arguments
.main.go:5: imported and not used: "_/C_/Users/ali/Desktop/test/gotime"
.main.go:10: undefined: Now

You can look at all of the package on GitHub:

Link for this package

How can I solve this problem?


Source: New Questions

Leave a Reply