Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gc: undefined method caught in linker but not compiler #3817

Closed
petar opened this issue Jul 12, 2012 · 1 comment
Closed

gc: undefined method caught in linker but not compiler #3817

petar opened this issue Jul 12, 2012 · 1 comment

Comments

@petar
Copy link
Contributor

petar commented Jul 12, 2012

Not sure if this is an issue:

If you make a package:

package pkg
type NopWriter struct{}
func Write([]byte) (int, error)

Notice, how I forgot to define the function. The compiler produces no error.
However, if you use this in a program:

package main
import ("log"; "pkg")
func main() {
  log.New(NopWriter{}, "", 0)
}

The linker will report the error.

Maybe the compiler should be catching this?

hg id = 46ca86e70e96

darwin
amd64
@robpike
Copy link
Contributor

robpike commented Jul 12, 2012

Comment 1:

Working as intended. Forward declarations are used to provide signatures for functions
from other languages, such as assembly functions.  The absence of a definition cannot be
detected until link time.

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants