First steps
folder includes 6 small scripts I managed using Golang
- even
- geometry
- max
- multithread
- strings
- sum
To run a single script go to first_steps
folder and run go run even.go
in example
Write a function which takes an integer and halves it and returns true if it was even or false if it was odd. For example half(1) should return (0, false) and half(2) should return (1, true).
Just a plain code to measure perim and area of rect
and circle
by using interface
and structs
Write a function with one variadic parameter that finds the greatest number in a list of numbers.
Just a plain code to print ping pong
string by using channels
There are most common string
fuctions you might use
Sum is a function which takes a slice of numbers and adds them together. What would its function signature look like in Go?
We are building a simple REST-API with Golang a router package called Mux. The main resource we're going to work with is post
Go to rest_api
folder, run go install
, then run go run main.go
and use the Postman for testing purposes.
Available endpoints
POST http:localhost:8000/posts
{
"title": "yours title",
"body": "yours body text"
}
GET http:localhost:8000/posts
GET http:localhost:8000/posts/1
PUT http:localhost:8000/posts/1
{
"title": "new awesome title",
"body": "new awesome body"
}
DELETE http:localhost:8000/posts/1