You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Go compiler and linker are currently built as command line tools. This issue proposes refactoring so they can be used as libraries.
Benefits:
External applications could compile code in a server (or even browser) environment. For example a wasm mode for https://compile.jsgo.io/ and https://play.jsgo.io/. Currently this is impossible.
The go command line tool currently uses os/exec to spawn sub processes when it needs to compile and link. If the compiler and linker were built as libraries, this could be accomplished in-process, without the overhead of os/exec.
Problems:
The current code directly accesses the filesystem with the os package for reading the input code and writing the output binaries. A solution would need an abstraction layer, similar to build.Config.
The current codebase makes extensive use of package level variables to store state - this would need to be refactored.
This will increase the public surface area of the compiler API.
The text was updated successfully, but these errors were encountered:
agnivade
changed the title
cmd/compile: refactor compiler and linker to be libraries
proposal: cmd/compile: refactor compiler and linker to be libraries
Jul 14, 2018
The Go compiler and linker are currently built as command line tools. This issue proposes refactoring so they can be used as libraries.
Benefits:
go
command line tool currently usesos/exec
to spawn sub processes when it needs to compile and link. If the compiler and linker were built as libraries, this could be accomplished in-process, without the overhead ofos/exec
.Problems:
os
package for reading the input code and writing the output binaries. A solution would need an abstraction layer, similar tobuild.Config
.The text was updated successfully, but these errors were encountered: