The `gio` name clashes with a widely deployed GNOME tool.
Rename our tool to `gogio`, "the go tool for gio programs".
Fixes gio#20
Signed-off-by: Elias Naur <mail@eliasnaur.com>
I was seeing an extra newline when some errors were printed, like:
$ gio foo
please specify target
$
The source of the little bug was a trailing newline in the error
messages. Printing the messages already adds a newline.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Use the Go import path to create an appID based on the domain name
plus the last directory location in the import path.
Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
Since the main README recommends Go 1.13 or later, let's make the go.mod
files reflect that. This will enable starting to use new language
features.
Modules that still build on 1.12 will continue to work on that version
just fine; this line is just a hint to enable new language features for
versions of Go new enough.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
First, vet was upset by two incorrect fmt verbs. One was an extra %x,
when there was just one argument, so remove it. Another was a %p with a
non-pointer. It's a struct, so for now simply use %#v.
Second, staticcheck found some unused or unnecessary bits of code;
remove the obvious ones.
Finally, staticcheck also complained about some error strings which were
capitalized or had periods. Adjust those, which also makes all error
messages more consistent.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
While we're here, split the usage print out to its own function and
don't display the usage when a package is missing.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
If there is an appicon.png file in the main package the gio tool
will use it for Android and iOS apps in buildmode exe.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Android can only run c-shared libraries which means that every
Gio program must create its window and event loop from an init
function.
The same applies to iOS but for a more benign reason: the gio tool
builds programs in c-archive mode for iOS and links the binary with
a Objective-C driver.
Allow Gio programs to run off its main function by linking to and
invoking main even from Android libraries and iOS ditto.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change `go list <pkg>` was used to sanitize the import
path of the package argument. That doesn't work well for building
Go source files directly:
gio -target android helloworld.go
where `go list helloworld.go` simply returns "command-line-arguments".
A better way is to leave the package path alone, and compute the
output file separately from the import path, as reported by
`go list -f {{.ImportPath}} <pkg>`.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Compressing resources.arsc result in warnings such as
"resources.arsc in APK '...' is compressed."
in the adb logs.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The verbose flag only triggered printing of commands, which is
traditionally named -x by other Go tools.
The -work flag will print and preserve the temporary directory.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
64-bit support was added in iOS 8 on iPhone 5S and newer,
32-bit support was dropped from iOS 12.
Gio is new and we have an opportunity to see if we can live without it.
We can always add 32-bit support back; it's harder to break users
later.
Signed-off-by: Elias Naur <mail@eliasnaur.com>