Invalid import path

Hey All,

I’m taking one of Todd McLeod’s courses and running into a stumbling block.

For some reason I’m getting an “invalid import path” error when trying to run some code I"m writing. In the same folder as my main.go file, I have a another folder that contains a custom package I wrote.

This is the package I’m trying to import:

//Package dog takes human years and turns them into dog years
package dog

//Years takes human years as parameter and converts it to dogs years by multiplying the parameter by 
7 and returning the result
func Years(h int) int{
return h * 7


And my main.go file…

package main
type k struct {
name string
age  int

func main(){

homey := k{
	name: "Kiki",
	age:	dog.Years(5),



# are not valid in a package name.

See, especially:

Implementation restriction: A compiler may restrict ImportPaths to non-empty strings using only characters belonging to Unicode’s L, M, N, P, and S general categories (the Graphic characters without spaces) and may also exclude the characters !"#$%&'()*,:;<=>?[\]^{|}` and the Unicode replacement character U+FFFD.

Thanks, appreciate your help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.