FAQ
I am trying to figure out how to start a project I am working on. I am
trying to get things to link together properly, I am sure I am missing some
simple thing. I am using a project directory as the online documentation
describes.

My main is the the src directory called .../src/emulator.go and it looks
like this:

package main
import (
     // system packages
     "fmt"
     // local packages
     "emulator/cfg"
)

func main() {
     cfg.Load("asdasd")
     cfg.Name()
     fmt.Printf("Hello, world")
}

and I have a file called .../src/emulator/cfg/cfg.go and it looks like this:

package cfg
import "fmt"
type Config struct {
     name string
     size int
}

func (c *Config) Load(name string) {
     c.name = name
     fmt.Printf("config called\n")
}

func (c *Config) Name() {
     fmt.Printf("Name = %s\n", c.name)
}

Here is the result of "go build emulator.go"

# command-line-arguments
./emulator.go:17: undefined: cfg.Load
./emulator.go:18: undefined: cfg.Name

I have probably made some silly error. Can anyone help?

Thanks,
-=chuck=-

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Tamás Gulácsi at Nov 24, 2014 at 10:29 pm
    1. Put emulator.go under src/emulator
    2. go build emulator
    3. Share the profit with me!

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 24, '14 at 9:24p
activeNov 24, '14 at 10:29p
posts2
users2
websitegolang.org

2 users in discussion

Chuck Tilbury: 1 post Tamás Gulácsi: 1 post

People

Translate

site design / logo © 2022 Grokbase