Code  Camp

Code Camp


Learn Go Programming - Golang Tutorial for Beginners

Learn the Go programming language (Golang) in this step-by-step tutorial course for beginners. Go is an open source programming language designed at Google that makes it easy to build simple, reliable, and efficient software.

⭐️ Course Contents ⭐️
⌨️ (0:00:00) Introduction
⌨️ (0:16:57) Setting Up a Development Environment
⌨️ (0:35:48) Variables
⌨️ (0:57:05) Primitives
⌨️ (1:26:29) Constants
⌨️ (1:47:53) Arrays and Slices
⌨️ (2:17:20) Maps and Structs
⌨️ (2:48:00) If and Switch Statements
⌨️ (3:21:17) Looping
⌨️ (3:41:34) Defer, Panic, and Recover
⌨️ (4:03:57) Pointers
⌨️ (4:21:30) Functions
⌨️ (4:57:59) Interfaces
⌨️ (5:33:57) Goroutines
⌨️ (6:05:10) Channels

#go #web-development #webdev #goalng

What is GEEK

Buddha Community

Learn Go Programming - Golang Tutorial for Beginners

Learning Go — Array, Slice, Map

We have already seen how to create and work with variables, pointers, and Constants. In this article, we are going to see the four important collection types built into the language.
We start with humble Arrays, from there we move on to Slice, an evolved version of Array. From Slice, we talk about the map a key-value pair collection. Let’s start with Arrays here.

#golang-tutorial #golang #go-programming #go-programming-language #programming

Zander  Herzog

Zander Herzog


Secure HTTPS servers in Go

In this article, we are going to look at some of the basic APIs of the http package to create and initialize HTTPS servers in Go.

Image for post


In the “Simple Hello World Server” lesson, we learned about net/http package, how to create routes and how [ServeMux]( works. In the “Running multiple HTTP servers” lesson, we learned about [Server]( structure and how to run multiple HTTP servers concurrently.

In this lesson, we are going to create an HTTPS server using both Go’s standard server configuration and custom configuration (using [_Server_]( structure). But before this, we need to know what HTTPS really is?

HTTPS is a big topic of discussion in itself. Hence while writing this lesson, I published an article just on “How HTTPS works?”. I advise you to read this lesson first before continuing this article. In this article, I’ve also described the encryption paradigm and SSL certificates generation process.

If we recall the simplest HTTP server example from previous lessons, we only need http.``[ListenAndServe]( function to start an HTTP server and http.``[HandleFunc]( to register a response handler for a particular endpoint.

Image for post


In the example above, when we run the command go run server.go , it will start an HTTP server on port 9000. By visiting http://localhost:9000 URL in a browser, you will be able to see a Hello World! message on the screen.

Image for post


As we know, the nil argument to ListenAndServe() call invokes Go to use the [DefaultServeMux]( response multiplexer, which is the default instance of ServeMux structure provided globally by the Go. The HandleFunc() call adds a response handler for a specific route on the multiplexer instance.

The http.ListenAndServe() call uses the Go’s standard HTTP server configuration, however, in the previous lesson, how we can customize a server using [Server]( structure type.

To start an HTTPS server, all we need do is to call ServerAndListenTLS method with some configuration. Just like ServeAndListen method, this method is available on both the http package and the Server structure.

The http.``[ServeAndListenTLS]( method uses the Go’s standard server implementation, however, both [Server]( instance and Server.``[ServeAndListenTLS]( method can be configured for our needs.

#go-programming-language #go #golang-tutorial #go-programming #golang

张 小龙


Anatomy of Conditional Statements and Loops in Go

Go provides if/else and switch conditional statements for code execution based on certain conditions. To execute some code over and over again, we have the for loop.

The if/else conditional statement

Go provides if, if-else, if-else if-else variants of if/else statement we are familiar with. It is used to check a condition, and execute some code when the condition is true or false.

The if condition

Simple use of if condition is demonstrated below. Unlike most of the programming languages, Go does not allow to wrap the condition inside parenthesis ().

#golang #programming #golang-tutorial #go-tutorial #go

Golang Tutorial: Learn Go Programming Language for Beginners

Go is an open-sourced programming language that made its first appearance about 11 years ago. The language is very young compared to 30-year-old Python and 35-year-old C++.

Go was designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. The purpose of Go was to make software development faster and easier for developers.

According to this HackerEarth survey, Go is the most sought-after programming language among students and professional developers.

In fact, Go is one of the easiest languages to learn. In this article, I will try to introduce some of the basic concepts of Go. I hope this article motivates you to learn the language further. Let’s get started!

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Hello World

Here is the Go code to print ‘Hello World’.

package main 

import "fmt" 

func main () {
  fmt.Println("Hello World") 

The first line is called a package declaration and every Go program starts with a package declaration.

The next line, import “fmt” is an import statement. The import keyword allows us to import and use code from other packages.

fmt is short for format, but commonly pronounced as ‘fumpt’. You can call it whatever you want.

The main() function is a special function. A file with a package main declaration will automatically run the main() function.

Inside the main function block, we have fmt.Println(“Hello World”).

Println is a function used to print text, which in our case is Hello World.

Variables and Constants

In Go, we can declare a variable either with the variable’s type or with an initializer using the var keyword. Multiple variables of different types can also be declared at once.

var a, b int = 0, 1

func main() {
	var c, d, e = true, "GO", 2.33
	f := -5
	fmt.Println(a, b, c, d, e, f)

If the type of the variable is not mentioned then the variable will take the type of the initializer.

Inside a function, the := short assignment statement can be used instead of a var declaration. However, this is not possible outside a function.

Constants are declared like variables, but with the const keyword. Constants can be character, string, boolean, or numeric values.

#go #golang #programming #web-development #developer

Fannie  Zemlak

Fannie Zemlak


What's new in the go 1.15

Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.

As Go promise for maintaining backward compatibility. After upgrading to the latest Go 1.15 version, almost all existing Golang applications or programs continue to compile and run as older Golang version.

#go #golang #go 1.15 #go features #go improvement #go package #go new features