Underscores in Imports
Underscores in Imports Underscores in Go serve a few purposes. In U+005F, “_” is a letter (as a string). You may also see them as [ “_” ] in between successive digits and a base prefix. In this case, it’s to improve the readability of the code. You may also see them in function names, e.g., imaginary_lit.
The underscore is quite a versatile tool. They even have their place in defining the kind of action that will take place in a function. ⌘ Read more
Struct Tags with Underscore Before Function Names
In the Go world, an underscore (_) before an expression is called a blank identifier. As you may already know, identifiers—user-defined program components, e.g., name of a function, variable, or package—in Go must be preceded by an underscore or a letter (a-z or A-Z). If they aren’t, you’ll receive the compile- time error which essentially means Go cannot read the syntax of your code (you didn’t write your code correctly … ⌘ Read more
Validating an Email Address ⌘ Read more…
Take a Screenshot of a Webpage with Headless Chrome ⌘ Read more…
URL Encode a String ⌘ Read more…
Exit an Application, With or Without an Error Code ⌘ Read more…
Connect to PostgreSQL and Run a Query ⌘ Read more…
How to: Handle Errors within Wait Groups ⌘ Read more…
Mock S3 Uploads in Go Tests ⌘ Read more…
Argon2 Password Hashing ⌘ Read more…
Perform Sentiment Analysis on Sentences ⌘ Read more…
Foreach Loops: The Go Way ⌘ Read more…
Build a Basic Web Scraper in Go ⌘ Read more…
Get the IP Address of a HTTP Request ⌘ Read more…
Convert iota List to String in JSON ⌘ Read more…
How to Run a Single Test ⌘ Read more…
Generate a PDF in Go ⌘ Read more…
JSON Web Tokens: Authenticating your API ⌘ Read more…
Check Element Exists in a Slice ⌘ Read more…
Read a File to String ⌘ Read more…
Timeout a Function Call (with Goroutines & Channels) ⌘ Read more…
Find Common Colours in an Image ⌘ Read more…
How to Check If a String Starts With … ⌘ Read more…
Working with POST Request Data ⌘ Read more…
Go Get: Install All Packages ⌘ Read more…
Sublime Text Workflow: Auto Build & Format ⌘ Read more…
JSON Encode - Pretty Print ⌘ Read more…
Basic Docker Setup for HTTP Server (using docker-compose) ⌘ Read more…
Check If a Date/Time Has Been Set with IsZero ⌘ Read more…
Is Long/Lat within Polygon from GeoJson ⌘ Read more…
Convert Interface to Type: Type Assertion ⌘ Read more…
Run Code Once on First Load (Concurrency Safe) ⌘ Read more…
Disable Log Output During Tests ⌘ Read more…
Sending a Slack Message (without a library) ⌘ Read more…
Create a Basic HTTPS Server (using TLS) ⌘ Read more…
Waiting for Goroutines to Finish with a WaitGroup ⌘ Read more…
Parsing Dates from a String and Formatting ⌘ Read more…
Run System Commands & Binary Files ⌘ Read more…
Sorting an Array of Numbered String Values ⌘ Read more…
Creating & Writing to Temp Files ⌘ Read more…
Encode and Decode Strings using Base 64 ⌘ Read more…
HTTP Get Request with Timeout ⌘ Read more…
Get the HTTP Method from a Request ⌘ Read more…
AWS Lambda PDF Generator ⌘ Read more…
Substring: How to Split a String ⌘ Read more…
Apply Middleware to Your Route Handlers ⌘ Read more…
Generating a SHA256 HMAC Hash ⌘ Read more…
Converting a PDF to JPG (using ImageMagick) ⌘ Read more…
Creating, Wrapping and Handling Errors ⌘ Read more…
Struct Tags for Encoding/Decoding Data ⌘ Read more…