On Wednesday, 16 August 2023 at 14:05:49 UTC+1 John Pritchard wrote: I have a disparity between "go run" [ https://go.dev/play/p/5mr5M0luZ9k?v=goprev] and "go build" [https://github.com/syntelos/go-type-abstraction/tree/third]. Using go version 1.21.0.
I don't quite understand where "go run" comes into this. In your Makefile <https://github.com/syntelos/go-type-abstraction/blob/third/Makefile>, both options use "go build". "make list" is doing something dubious: go_sources := $(shell ls *.go) ... list: main/main.go $(go_sources) go build -o $@ $< That is, I think you're trying to compile "main/main.go" and "types.go" at the same time into a single object file. But types.go is "package types" whereas main.go is "package main". That should give you an error; if it doesn't, that makes me suspect that go_sources is in fact empty. The "make list" output you show in README.txt appears to confirm this: $ make go build -o list main/main.go # <<< note that no additional sources are listed on the command line In main.go, there is a pretty clear error that the compiler calls out in line 46: main/main.go:46:15: undefined: Abstract The corresponding source line <https://github.com/syntelos/go-type-abstraction/blob/third/main/main.go#L46> is: var abstract Abstract = types.Init() and as far as I can see, it's correct: you have no type "Abstract" in package main in main.go (in otherwise, you should be referring to "types.Abstract") -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a0716bee-a6b9-4ea7-b4a7-165c4ef43fabn%40googlegroups.com.