Go language Interface

One of the great features of the Go language is its Interface.

Compared to other languages ​​such as Java and C # that have an Interface, the main difference in the language function of Go’s Interface is that it is an interface that can declare a list of methods that are statically checked like a static language, but duck typing and duck typing Type assertion allows for flexible usage like a dynamic language.

However, this alone sounds like a simple choice that can be used according to the case. In fact, Go language packages, type systems, and cultural features allow…


When dealing with logs in Go, I think many people use third-party logging libraries.

I think the reason is that the standard log package has poor functionality, especially no level.

However, in terms of Go language fundamentalism, you still want to use the standard.

Rest assured, the standard log package doesn’t have levels, but that doesn’t mean it doesn’t take levels into account.

It only differs in its role as a logging package from the regular log libraries found in other languages.

Regarding the log level, the log level is basically not unified , I think that there are various…


Talking about the file permission, as in Linux, O_CREATEif the file does not exist with parameter, you can assign the permission value to the file while creating a new file. Click for detailed information about permissions .

2.3- Printing the File Line by Line

After selecting the file, we may want to select all lines one by one and write on the screen. For this, we can choose a usage like below. Of course, you can play and process each line separately as you move line by line on the file.

file, err := os.OpenFile("deneme.txt", os.O_RDONLY, 0755)
if err != nil {
panic(err)
}
// Blok sonunda…


Although at the bottom level, all data is composed of bits, computers generally operate on fixed-size numbers, such as integers, floating-point numbers, bit arrays, memory addresses, and so on. By further organizing these numbers together, more objects can be expressed, such as data packets, pixels, poems, and even any other objects. The Go language provides a rich form of data organization, which relies on the built-in data types of the Go language. These built-in data types take into account the characteristics of hardware and the convenience of expressing complex data structures.

Go language divides data types into four categories: basic…


A great feature of Go’s standard library is its code performance monitoring tools. These packages exist in two places:

net/http/pprofruntime/pprof

In fact, net/http/pprof simply exposes runtime profiling data from the runtime/pprof package on an HTTP port.

pprof support in Beego

The Beego framework currently supports pprof, however it is not turned on by default. If you need to test the performance of your application, (for instance by viewing the execution goroutine) such information from Go’s default package “net/http/pprof” already has this feature. Because beego has repackaged the ServHTTP function, you can not open the default feature included in pprof. …


Ask people inside and outside the company about what is difficult to understand when writing Go for the first time, and what are the difficult points for people who are familiar with other languages. I tried to summarize it. There are many more, but there are too many, so first of all, this is the place. It is expected that more and more people will develop with containers, and at that time, more and more people will start using Go, which has excellent compatibility with containers.

Go is a concept that makes the core of the language simple, and when…


The Go language with its simplicity, concurrency support, rich package ecosystem, and ability to compile down to a single binary is an attractive solution for writing services on Ubuntu.

When you want to deploy a dead-simple Go API and you don’t really have the urge to learn Docker and large scale deployment (although certainly a useful skill), you have come to the right tutorial.

We’re going to have a quick look at setting up running a golang web app on a Linux VPS without spending more than 10 minutes on it.

First Test your app

Let’a assume our goapp is…


This is a summary of the topics that will be the io/ioutilpackages that have been updated in Go 1.16 "deprecated".

Summary

  • Go1.16 from the io/ioutilpackage of features osdoor iohas shifted to the package
  • It is recommended to use new functions in the package ioor new implementation code.os
  • io/ioutilEven if the package becomes "deprecated", it "deprecated"does not mean that it will break in the future.
  • Existing code keeps working
  • go fix Command is not supported

content

From Go1.16, the io/ioutilfunctions included in the package "deprecated"will be. Related proposals are # 40025 and # 42026 . In general, utilpackage names such as, as introduced…


First, it’s very important to say that both Go and Rust are absolutely excellent programming languages. My purpose here is not to criticise any language

In this article, I’ll try to give a brief overview of where I think Rust is the ideal choice, and where I think Go is a better alternative.

If you had to sit down and think of the programming languages which were best aligned with the motive to develop secure, microservice favoring frameworks and apps, you would again find yourself staring at the two languages.

Even after being similar in some prominent ways like maturity…


When Donald J. Trump was starting his career in real estate, he could have chosen a safer path than the one he ultimately took. His father’s real estate company had already developed impressive properties in Queens, New York. He could have built an enviable real estate empire there without ever crossing the river to become a major force in Man- hattan real estate and beyond.

Nobody made him try his hand at in the real estate “big leagues.” Nev- ertheless, he was determined to take his enterprise to that next level. To do that, he had to face risk.

It…

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