If you are like me and getting errors while trying to compile your go lang code without having a go.mod in v1.18
Documentation is a huge part of writing any software. In java you have JavaDoc, which most of the developers adhere to. It is healthy and rich way of exposing the source documentation.
GoLang doesn’t have a try and catch like the popular C++ or Java languages, what it has is panic-recover.
Package encoding provide capabilities to convert data to and from byte-level and textual representations.
In last few blogs I have written about reading commandline parameters reading files and using the os package.
In this blog, I will combine some these items to read a file byte by byte using the bufio package func’s.
In the last blog I talked about command line arguments os.Args[]. In this I will try and create a sample banner program that shall
Take 3 arguments n - Number of times a message has to be repeated. m - The message that needs to be shown. d - If debug message needs to be shown. I am going to use the flags package.
Reading the golang official documentation is fun, today I saw the Variables in package os
var Args []string It allows you to hold command line arguments and a simple main program that can help you validate this.
In the last blog, I tried reading a file in GoLang.
My repository in GitHub has all the code that I write (link) Now, I will extend the same program to write to the same file.
Learning a new syntax and the libraries is always a task, and the only way forward is gradual. In this blog I will try to create a small program to read a text file and will keep updating the program to include more sophistication
Must Read # https://blog.golang.org/laws-of-reflection https://golang.org/pkg/reflect/ https://golang.org/pkg/reflect/#Kind https://golang.org/pkg/reflect/#Value Package reflect implements run-time reflection, allowing a program to manipulate objects with arbitrary types. Reflection is a way to examine own structure. Let’s try and learn it via examples.
Interfaces are an interesting concept to learn in GOLANG. There are a tonne of informative articles and here is my contribution to it.
In classical Object Oriented everything is treated in parlance of Object or Class like in Java or C++. In Go there is no class or inheritance.
When two processes are executing concurrently, the exact order of execution of instructions is not deterministic. Without explicit synchronization instructions it is difficult to predict the outcome of these concurrent execution of process.
GOLANG # Go is a powerful yet simple language. The nuances of assembling a workspace, sometimes are overwhelming, yet when it comes to simplicity it is very powerful.
Helpful links # http package How to write go code. First program Effective go GO webserver GO Packages Specification - Go JSON in Go blog Go command reference Using Go modules These are some of the helpful links I have used in the past for understanding Go and developing code.
Having practiced creating loads of Console based programs of golang, it is now time to try something new - A Web Service.
In this blog, I will try and create a Web Service (RESTful) that will be built entirely on Go.
With the Corona-Lockdown in place “literally”, it was time to squeeze out some me-time to continue the quest for GO-Proficiency.
Just like Java or C++ there are standard libraries (packages) available with golang. The one that you might end up using the most often is strings.
For this blog, I was writing another practice exercise that is meant to count number of words in an input string.
It was an interesting exercise, and I solved in three ways. More details available here @ exercism.io
Introduction # RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so:
A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the alphabet at least once. The best known English pangram is:
The quick brown fox jumps over the lazy dog.
Funny thing about simple programs is that there are too many optimization options available that never lets you feel content.
Last few weeks have been interesting, a new year just embarked, my learning pace slowed down; comparatively due to the festivities and obligations around, but I am still trying to maintain.