1609292738
Go programming Tutorial (Hindi) | Variables
#go #golang #developer
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
1599854400
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
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
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
1596728880
In this tutorial we’ll learn how to begin programming with R using RStudio. We’ll install R, and RStudio RStudio, an extremely popular development environment for R. We’ll learn the key RStudio features in order to start programming in R on our own.
If you already know how to use RStudio and want to learn some tips, tricks, and shortcuts, check out this Dataquest blog post.
[tidyverse](https://www.dataquest.io/blog/tutorial-getting-started-with-r-and-rstudio/#tve-jump-173bb26184b)
Packages[tidyverse](https://www.dataquest.io/blog/tutorial-getting-started-with-r-and-rstudio/#tve-jump-173bb264c2b)
Packages into Memory#data science tutorials #beginner #r tutorial #r tutorials #rstats #tutorial #tutorials