64c10381ad
This is necessary to support other go code that uses build tags to control which files build on which platforms. For example, the github.com/golang/protobuf/proto package includes two implementations of pointer: pointer_reflect: // ... // +build appengine js // This file contains an implementation of proto field accesses using package reflect. // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can // be used on App Engine. pointer_unsafe.go: // ... // +build !appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. Without this change, microfactory tries to include both files, which breaks, since that enables multiple implementations of the same symbols. This implements the logic to find the +build comments (following the spirit of the functionality in go/build, even though they make different choices of parsers), and the logic to match the tags to the current system (which isn't exported as public API, so we have a simplified version). Since we're only parsing the comments before the import statement, this does not significantly affect performance. Test: Build github.com/golang/protobuf/proto Change-Id: I10c48472d3f9f3e96b800a5d7c15450b1737002b |
||
---|---|---|
.. | ||
main | ||
microfactory.bash | ||
microfactory.go | ||
microfactory_test.go |