Contexts - Cancellation, Timeout and Propagation
Golangbot | Golang tutorial
by Naveen Ramanathan
1y ago
What is a context? Context is a package in the standard library which is mainly used to propagate cancellation signals from one function to another or even from micro service to another. Let's consider the example of a user sending a get request to a web server to download 50 images, zip it and send the zipped response back. The request has been triggered from the browser and let's say it takes 70 seconds to complete. The user is not patient enough and decides to cancel it when it is still being processed by the server. Wouldn't it be nice if the server gets to know that the user(client) has c ..read more
Visit website
Error Wrapping
Golangbot | Golang tutorial
by Naveen Ramanathan
1y ago
Welcome to tutorial no. 32 in our Golang tutorial series. In this tutorial we will learn about error wrapping in Go and why do we even need error wrapping. Let's get started. What is error wrapping? Error wrapping is the process of encapsulating one error into another. Let's say we have a web server which accesses a database and tries to fetch a record from the DB. If the database call returns an error, we can decide whether to wrap this error or send our own custom error from the webservice. Let's write a small program to understand this. package main import ( "errors" "fmt" ) va ..read more
Visit website
MySQL Tutorial: Selecting Single and Multiple Rows
Golangbot | Golang tutorial
by Naveen Ramanathan
2y ago
MySQL Series Index Connecting to MySQL and creating a Database Creating a Table and Inserting Rows Selecting Single Row and Multiple rows Prepared statements - WIP Updating rows - WIP Deleting rows - WIP Welcome to tutorial no. 3 in our MySQL tutorial series. In the previous tutorial, we discussed creating a table and inserting rows into the table. In this tutorial, we will learn how to select a single row as well as multiple rows from a table. Selecting a single row The product table we created in the previous tutorial has three rows. Running select * from product; on the table returns the fo ..read more
Visit website
MySQL Tutorial: Creating a Table and Inserting Rows
Golangbot | Golang tutorial
by Naveen Ramanathan
3y ago
Welcome to tutorial no. 2 in our MySQL tutorial series. In the first tutorial, we discussed how to connect to MySQL and create a database. In this tutorial, we will learn how to create a table and insert records into that table. Series Index Connecting to MySQL and creating a Database Creating a Table and Inserting Rows Selecting single/multiple rows - WIP Prepared statements - WIP Updating rows - WIP Deleting rows - WIP Create Table We will be creating a table named product with the fields product_id, product_name, product_price, created_at and updated_at. The MySQL query to create this table ..read more
Visit website
MySQL Tutorial: Connecting to MySQL and Creating a DB
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
Welcome to tutorial no. 1 in our MySQL tutorial series. In this tutorial, we will connect to MySQL and create a database. We will also Ping the DB to ensure the connection is established properly. Series Index Creating and connecting to the DB Inserting records into the Database Selecting single/multiple records Prepared statements Updating records Deleting records Importing the MySQL driver The first step in creating the MySQL database is to download the MySQL driver package and import it into our application. Let's create a folder for our app and then download the MySQL package. I have creat ..read more
Visit website
WebAssembly: DOM Access and Error Handling
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
Welcome to tutorial no. 2 of our WebAssembly tutorial series. Series Index Introduction to WebAssembly Using Go Accessing DOM from Go using Javascript In the first tutorial of this tutorial series, we created and exposed a function from Go and called it using JavaScript. I highly recommend reading the first part https://golangbot.com/webassembly-using-go/ if you have not read it yet. In this tutorial, we will develop a UI for our application, handle errors, and also manipulate the DOM of the browser from Go. Creating the UI and calling the wasm function Let's create a very simple UI using HTML ..read more
Visit website
WebAssembly: Introduction to WebAssembly using Go
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
Welcome to tutorial no. 1 of our WebAssembly tutorial series. Series Index Introduction to WebAssembly Using Go Accessing DOM from Go using Javascript What is WebAssembly? JavaScript has been the only programming language that the browser understands. JavaScript has stood the test of time and it has been able to deliver the performance needed by most web applications. But when it comes to 3D games, VR and AR apps, JavaScript is not quite up to the mark since it is interpreted. Although JavaScript engines such as Gecko and V8 brought Just in Time compilation capabilities, JavaScript is not able ..read more
Visit website
Debugging Go Applications Using Delve
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
Need for a debugger The simplest form of debugging in any programming language is by using print statements/logs and writing to standard out. This definitely works but becomes extremely difficult when the size of our application grows and the logic becomes more complex. Adding print statements to every code path of the application is not easy. This is where debuggers come in handy. Debuggers help us to trace the execution path of the program using breakpoints and a host of other features. Delve is one such debugger for Go. In this tutorial, we will learn how to Debug Go applications using Delv ..read more
Visit website
Go Packages
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
This tutorial is for Go version 1.13 or later and uses Go modules. If you are using an older version of Go or looking for the GOPATH version of this tutorial, please visit https://golangbot.com/packages/. Welcome to tutorial number 7 in Golang tutorial series. What are packages and why are they used? So far we have seen Go programs that have only one file with a main function and a couple of other functions. In real-world scenarios, this approach of writing all source code in a single file is not scalable. It becomes impossible to reuse and maintain code written this way. This is where pack ..read more
Visit website
DIY Pick and Place Robot
Golangbot | Golang tutorial
by Naveen Ramanathan
4y ago
I am working on a DIY Pick and Place Robot course with my friend Balaji. I am taking care of the software side of things while the hardware is taken care by Balaji. Description A pick and place robotic system automates the process of picking up parts and placing them in a desired location. These robots plays a major role in industrial automation. The system consists of links, joints & gripper equivalent to a human hand. Each joint in the robot and the gripper contains a separate motor for automating the pick and place operation. Prerequisite Basic programming knowledge in Go No knowle ..read more
Visit website

Follow Golangbot | Golang tutorial on FeedSpot

Continue with Google
Continue with Apple
OR