Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

msepp/go-astilectron-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-astilectron-template

NOTE this repo is completely redudant and obsolete nowadays and I encourage you not to use this code as anything else than reading material.

A project template for building desktop apps with Golang, Electron and Angular.

Uses go-astilectron for Golang/Electron binding.

This is meant to be a template, a base for a project that you modify and extend to implement the features you need. As such I won't be covering all different use cases in the code. It might be more insightful to view this as an example than anything else.

Features

  • Ready recipes for building for Windows/Linux 32/64bit targets
  • Automatically download and install requirements
  • Easily switch Electron version
  • Easily enable/disable dev-tools for builds
  • Builds for different OS/Arch get their specific Electron bundles
  • UI builds are part of the main build
  • Doesn't need extra http server in Go to serve the UI assets
  • Disembed assets either under tmp to leave no files behind or under users home/profile for faster launch times on consecutive launches.

Requirements

  • You should have Go installed and set up.
  • Uses Makefiles for build automation, so you should have make installed.
  • wget is required for automatically downloading vendored packages
  • asar is used for bundling UI resources
    • npm install -g asar
  • angular-cli for UI scaffolding.
  • go-bindata is used for packing binary files into executable.
    • go get -u github.com/lestrrat/go-bindata/...
  • go-homedir
    • go get -u github.com/mitchellh/go-homedir
  • go-astilectron
    • go get -u github.com/asticode/go-astilectron
  • Windows builds tested using git bash.

Usage

Make sure you have the requirements installed and run the following commands:

go get -u github.com/msepp/go-astilectron-template/...
cd $GOPATH/src/github.com/msepp/go-astilectron-template/example
make

This will build the sample for your OS/Arch, if supported.

Building non-host targets happens with make go-astilectron-template-GOOS-ARCH[.exe], where GOOS, ARCH should be replaced with target values.

Just copy the example directory and you should now have a working base for a GUI applicaton project.

Changing electron/astilectron version

Different versions of Electron or Astilectron can be used by specifying the target versions in the main Makefile. When changed, new versions will be downloaded at next build.

Wrinkles

  • Darwin builds are not supported (but maybe are easy to add) since I have no way to verify functionality atm.
  • Uses a restmpl.go file for empty resources bundle to make automated builds faster when using IDEs. This file is swapped for the generated resources during build.
  • Does not support development builds for UI atm, but devTools can be enabled/disabled in Makefile.
  • Building on a 32bit host most likely won't work due to limited address space. Use 64bit host and cross-compile.

About

a template project for creating GUI apps using electron, golang and angular

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors