Build desktop applications using Go and Web technologies

Build desktop applications using Go and Web technologies

2022-10-31 0 1,163
Resource Number 47245 Last Updated 2025-02-21
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue features WAILS, a project that uses Go and Web technologies to build desktop applications.

Build desktop applications using Go and Web technologies插图

Wails is a framework that helps you write desktop applications using Go and Web technologies. For the front end, use the Webview library. However, it uses the platform’s native rendering engine (currently Webkit for Linux and Mac, MSHTML for Windows). The front end is coded in HTML/Javascript/CSS, and the back end is pure Go. Through the binding mechanism, Go code can be exposed to the front end as a function that returns promises. The project compiles to a single executable file into which all resources are bundled. On Windows and MacOS, binaries can be bundled into platform-specific packages for distribution.

Note: The rendering engine is a WebView, not a bundled Web browser, so some “browser apis” will not be available for your application, such as localstorage. Most applications don’t need to use them, and if you still want to, you can use Go for most things.

Function

  • Go
  • Build UI interfaces with any front-end technology
  • Quickly generate Vue, Vuetify, React front-end code for your Go app
  • Expose the Go method to the front end with a simple bind command
  • Using native rendering engine – no embedded browser
  • Shared Event system
  • Native File system dialog
  • Powerful command line tools
  • Across multiple platforms

Overview

  • Wails

Wails is designed to minimize the differences between web technologies and Go. The front end is a Webview component, and you can use any common Javascript framework you like to develop the front end code and interact with the Go code inside. This is achieved through a shared IPC mechanism.

Build desktop applications using Go and Web technologies插图1

  • IPC Overview

The IPC mechanism can run in two runtimes, one running in Javascript and one running in Go. They all provide a simple interface that relieves developers of the burden of dealing directly with IPC mechanisms.

Build desktop applications using Go and Web technologies插图2

The runtime shares common components that developers can interact with: bindings and events.

Build desktop applications using Go and Web technologies插图3

  • Binding

The Wails application provides a way for you to (bind) exposed Go code to the front end. Using this method, you can bind any function or exposed structural method. At startup, Wails analyzes the bound functions/methods and automatically provides the equivalent functions in Javascript. Enables you to call the bound Go code directly from Javascript.

Build desktop applications using Go and Web technologies插图4

JavaScript wrap functions that handle all the complexity of calling Go code. You simply call the function using Javascript and receive a Promise. The binding Go code functionality handles all the complexity of the binding. If the call to the Go code completes successfully, the result is passed to the resolve function. If an error is returned, it is passed to the reject function.

  • Event

Wails provides a unified event system, similar to Javascript’s native event system. This means that any event sent from Go or Javascript can be received by either party. Data can be passed along with any event. In this way, you can do simple things like let the background process run in Go and tell the front end to update the page.

Build desktop applications using Go and Web technologies插图5

Installation

  • Installation command

The installation process is very simple, just run the following command:

go get -u  github.com/wailsapp/wails/cmd/wails

After installation, the “wails update” command can be used for subsequent updates.

To get the latest pre-release with the latest features you can attach the -pre tag after it: wails update-pre.

To complete the setup, run the installation command wails setup and fill in your name and email address.

  • Generate new project

Generate a new project using the initialization command wails init, select the default options.

  • Build

Switch to the project directory cd my-project and build your project using the build command build command wails build.

If all goes well, you should have a compiled program in your local directory. If using Windows, use./my-project to run it or double-click myproject.exe.

Build desktop applications using Go and Web technologies插图6

Project presentation

Build desktop applications using Go and Web technologies插图7WOMBAT

Build desktop applications using Go and Web technologies插图8

SURGE

Build desktop applications using Go and Web technologies插图9

MOLLY Purse

Build desktop applications using Go and Web technologies插图10

PORTFALL

Build desktop applications using Go and Web technologies插图11

RESTORIC

Build desktop applications using Go and Web technologies插图12

OPTIMUS Screenshot editor

—END—

Open Source protocol: MIT

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code Build desktop applications using Go and Web technologies https://ictcoder.com/build-desktop-applications-using-go-and-web-technologies/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services