If you want to use the TSL connection, you can use the following settings: func NewTlsConfig() *tls.Config { certpool := x509.NewCertPool() ca, err := ioutil.ReadFile("ca.pem") if err != nil { log.Fatalln(err.Error()) } certpool.AppendCertsFromPEM(ca) // Import client cer...
Another common file operation is the need to write strings to a file line by line. In this section, we will write a program to create a file with the following content. Welcome to the world of Go.Go is a compiled language.It is easy to learn Go. Let’s get to the code right away...
5 min read Overview Go helps you make faster scalable backends and this guide will show you how to connect your backend to Ethereum (and make it even faster, more reliable, and globally accessible, all thanks to QuickNode’s global infrastructure). ...
To start building our application, let’s go ahead and create our entry point into the app by creating a main.go file. Next, while we can set up our application manually, we’ll instead leverage Cody to build out our starting point. In the Cody chat window, we can ask Cody...
I start the server in separate go routine so that exithandler pkg/logger Info os.Stdout Error os.Stderr logrus Next let's take care of the databases. I use migration tool written in GO that can be used as CLI or as a library. You can read more about it and find installa...
In the previous articles, we had to download and use many third-party libraries. In today's article, we will discuss how to delete Golang packages when they are no longer used. Method 1: Delete the source directory If you want to remove the installed packages, just delete the source dire...
Read byDr. One Listen to this story Many have wondered how a simple task sheet or applications that provide such functionality work. In this article, I invite you to consider how you can write your small service in Go in a couple of hours and put everything in a database. ...
File.inputStream(): To read contents of file to InputStream File.readBytes(): To read contents of file to ByteArray File.readLines(): To read lines in file to List of String File.readText(): To read contents of file to a single String ...
Welcome to tutorial no. 30 inGolang tutorial series. What are errors? Errors indicate any abnormal condition occurring in the program. Let’s say we are trying to open a file and the file does not exist in the file system. This is an abnormal condition and it’s represented as an error...
Add this content to the~/.bashrcto achieve the above mentioned. If your system using another shell system like zsh or fish shell, addd these to the respective rc file. Set theGOROOTlocation where the Go packages are installed in the system ...