In conversation with Go-Lang | Part1

In this blog, we shall be looking at following concepts :-

  • Best example of Interpreted Language.

Question: What’s the best example of an Interpreted Language ?

Answer: An example of an interpreted language is JavaScript. JavaScript’s source code is read directly by the browser when you’re running in the browser and then executed at runtime. There is no precompilation step and while in some interpreted environments there’s an intermediate format such as bytecode, there’s no precompilation step that you have to follow.

Question: What’s the modus operandi for compiled languages ?

Answer: A compiled language in contrast is transformed into a format that’s specific to an operating system. C and C++ are both compiled languages.

Question: Is GO-Lang a compiled or interpreted language ?

Answer: Go is a compiled language. Unlike Java which is compiled to bytecode that can run on multiple operating systems, Go is compiled to a form that can only run on a single operating system and it’s also statically typed, which means that its variables have specific types. You don’t always have to explicitly declare the types. There are sometimes inferred by the compiler. But they’re always known at compilation time. It can sometimes feel with Go like you’re working with an interpreted language because you can run a source code file without precompiling. But what’s really happening in the background is that the application is being compiled to a temporary executable.

Question: How do we deliver applications built in GO ?

Answer: When you’re creating applications that you’re going to deliver to users though, you’ll normally use the compilation tool known simply as Go, and as I mentioned, the compiled executable will only run on one operating system. So if you compile for Windows, that executable can only be run on Windows. If you compile for Mac, it can only run on Mac and so on.

Question: Is there a RunTime Component associated with GO ?

Answer: Applications built with Go contain a statically linked runtime. That is there’s a run-time component that’s packaged with the application during the compilation process.

Question: Usually, how is the size of compiled application compared to the Source code in Java & GO?

Answer: The size of a compiled application is much larger than its source code file and that’s because that runtime is being included. But there is no external virtual machine. So for example, in Java, you have an operating system specific virtual machine or JVM. That JVM is mandatory and expected to be installed on the client-machine and therefore the Java application which is compiled into bytecode can be very, very small. With Go, there is no external virtual machine and so that runtime has to be included in every compiled application.

Question: Is the GO an Object-oriented language ?

Answer: The answer with Go is yes, sort of. It implements some critical object-oriented features. For example, you can define custom interfaces in Go.

Question: Can we define the Interfaces defined in GO as well ?

Answer: An interface is a contract of sorts that defines a set of functions and then something that implements that interface has to implement those functions. In Go you can define types. Almost everything is a type in Go and every type implements at least one interface. When you add functions to a type in Go, they are now called methods and that’s an object-oriented term.

Question: Can we create our own Structures in GO as well ?

Answer: You can create your own structures or structs in Go and those can have member methods and member fields. So the types and structures of Go can feel a lot like the classes in a language such as Java or C#.

Question: What are those object oriented features, which are not present in GO ?


  • There were other object oriented features in other languages that aren’t present in Go. For example, there is no type inheritance in Go. You can’t create a type and say that’s going to be the super type and then create another something that’s called a subtype and inherit features from the super type. That’s just not a part of the Go architecture.

The main reason you won’t find these language features in Go is because the languages designers felt that these features which are common to very advanced languages make these languages harder to read and more susceptible to bugs. Everything you need to know about a Go program is right there on the surface. You don’t have to remember a rule of the language because it’s all there in the application’s code.

Question: How is GO formed and what all can we do with GO ?

Answer: Go is based on a number of different languages. It was originally designed as a next-generation language that could do everything you can do with C. Systems programming, application development, and so on. So it borrows a lot of syntax from C and it’s related languages, C++, C#, Java, and so on, but it also borrows syntax from other languages such as Pascal, Modula, Oberon, and other similar languages. At the end of the day, one of the attractions of Go is that you simply don’t have to do as much typing. Go programming is very concise and there aren’t a lot of unnecessary characters to get in the way. Now if you’re already an expert in one of those C-style languages, you will be ahead of the game with Go.

Question: What are syntax-rules in GO ?

Answer: Here are some critical syntax rules in Go :-

  • Go is case sensitive. So identifiers such as function, variable and type names, have to be spelled exactly the way you see them in the documentation.
  • Now, interestingly, the language specification says that semi-colons are supposed to be there, but you don’t have to type them. And that’s because the lexer, which is the software component that parses your code and analyzes it, adds the semi-colons during the compilation process as needed. In order to accomplish this, Go is sensitive to white space. That is line feeds, tabs, and so on.
  • In a four statement, the code that you want to iterate over is wrapped between those two braces now because of the rules of how the lexer analyses new lines, the first brace and a code block must be on the same line as any proceeding statement. Unlike, other C style languages that aren’t sensitive to white space, in Go, you don’t have the freedom to drop that beginning brace down to the next blank line.

You can learn about these and other built-in functions and types at this page in the online documentation,

Question: How can we try our hands dirty with Go-Lang ?

Answer: You’ll find documentation, code packages, downloadable binaries, and the Go Playground. The Go Playground is an in browser editor. And there’s a version of it embedded on this webpage. And from here, you can add and customize your Go code and run it instantly. The embedded version of the Go Playground on the homepage has a simple hello world application and you can immediately run it. Notice the message waiting for remote server. And then after the code is executed you’ll see the result right here on the screen. You can make changes. So for example, I’m going to change this to my name and run the code again. There’s also a full screen version of the GO Playground at And once again, it starts with the hello world application. When you run it, you’re doing exactly the same thing. This pull-down list offers various code templates.

Next, Let’s run the Fibonacci Closure application, I could select it and run it. But if I want to use that in the full screen version of the Playground, I can click share. Then, I see exactly the same code and I can run it from here. You can also fix formatting with the Go Playground. I’m going to take out some of these tab characters and make everything flushed to the left side. And then I’ll click the format button and everything is returned back to the way it was.

Question: What’s happening in the background, upon pressing RUN button?


  • In the background the Go Playground is simply using the Go Command with formatting commands.

Question: With Go-Playground, what are the other advantages/limitations ?


  • The playground also fakes the file system. It simulates read and write operations so you can write the files that you create and then read them within the same application run, but the changes aren’t persistent and there are limitations to what you can do.

Question: With Go-Playground, Are there any limitations ?

Answer: The Go Playground is completely free with no limitations. You don’t have to register to use it and you don’t have to pay any licensing fees. There are no limitations on the number of source code files you can work with and no limitations on the number of times you run your code. It’s a great way to test a bit of Go code without having to create and compile your own local source code files.

Question: With Go-Playground, Can I share my code with my peers ?

Answer: Yes, I’ll get an automatically generated URL and I can copy that and then I can send it to somebody and when they go to that URL they’ll see my code instead of the template code that’s available to everybody in the playground.

Question: Can you explain the basic syntax of the Go-Code-sample shown above ?


  • Every source-code-file developed in the GO language must have .go extension. The name of the file before the file extension DOE could be anything you like, but once again, it should be all lowercase and no spaces.
  • Next, say I want to package the runtime and build a binary file that I can distribute, I can do this, Go build., I don’t see any output, but now if I list the contents of this directory I see a new file named, hello. It has the same name as the folder in which it’s contained. If I then type, ./hello, I’m running the compiled version. And you may notice that it’s a lot faster than running that application with Go run.
  • This is now a compiled binary file, specifically designed to work on my operating system. If I take that file and copy it over to Windows, it isn’t going to work. And if you’re working on Windows, instead of seeing just, hello, you’ll see, hello.exe. It’s also possible to compile for other operating systems, but by default you’ll get a binary for your operating system.

References :-



Software Engineer for Big Data distributed systems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store