1602659197
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.
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.
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
1589642959
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
1596793260
http
package to create and initialize HTTPS servers in Go.(source: unsplash.com)
In the “Simple Hello World Server” lesson, we learned about net/http
package, how to create routes and how [ServeMux](https://golang.org/pkg/net/http/#ServeMux)
works. In the “Running multiple HTTP servers” lesson, we learned about [Server](https://golang.org/pkg/net/http/#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_](https://golang.org/pkg/net/http/#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](https://golang.org/pkg/net/http/#ListenAndServe)
function to start an HTTP server and http.``[HandleFunc](https://golang.org/pkg/net/http/#HandleFunc)
to register a response handler for a particular endpoint.
(https://play.golang.org/p/t3sOenOYAzS)
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.
As we know, the nil
argument to ListenAndServe()
call invokes Go to use the [DefaultServeMux](https://golang.org/pkg/net/http/#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](https://golang.org/pkg/net/http/#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](https://golang.org/pkg/net/http/#ListenAndServeTLS)
method uses the Go’s standard server implementation, however, both [Server](https://golang.org/pkg/net/http/#Server)
instance and Server.``[ServeAndListenTLS](https://golang.org/pkg/net/http/#Server.ListenAndServeTLS)
method can be configured for our needs.
#go-programming-language #go #golang-tutorial #go-programming #golang
1594369800
SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.
Models for SQL exist. In any case, the SQL that can be utilized on every last one of the major RDBMS today is in various flavors. This is because of two reasons:
1. The SQL order standard is genuinely intricate, and it isn’t handy to actualize the whole standard.
2. Every database seller needs an approach to separate its item from others.
Right now, contrasts are noted where fitting.
#programming books #beginning sql pdf #commands sql #download free sql full book pdf #introduction to sql pdf #introduction to sql ppt #introduction to sql #practical sql pdf #sql commands pdf with examples free download #sql commands #sql free bool download #sql guide #sql language #sql pdf #sql ppt #sql programming language #sql tutorial for beginners #sql tutorial pdf #sql #structured query language pdf #structured query language ppt #structured query language
1602659197
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.
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.
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
1596440100
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
.
if/else
conditional statementGo 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
.
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