- Introduction to go
- Installing go
- hello world
- go run
- go run main.go
- runs the code without creating a binary
- good for testing programs iteratively
- go build
- creates a binary
- good for distributing programs
- using go modules
- go mod init your.domain/path
- this is all we will do for now with go modules
- creating another go file: math.go
- adding numbers
- divide by zero
- throw an error if the right hand side is zero
- using functions in it in main.go
-
-
Save Xe/6cd20d412770fb03f4a958a8e664710d to your computer and use it in GitHub Desktop.
- Overview of how HTTP works
- Clients make requests to servers
- Servers return responses to clients
- Making a HTTP request to icanhazip.com
- import net/http
- making the request object
- http.NewRequest
- getting the response
- http.DefaultClient.Do
- validating the response
- status code 200
- parsing the data
- net.IP
- throwing an error when it's wrong
- error handling
- Testing
- Test math.go
- HTTP Testing
- Testing the real production server
- Creating a fake server
- sending a HTTP request to that server via the make request function we made earlier
- intentionally creating bad state
- Adding contexts
- Add the arguments
- Add it to the HTTP request
- Create test case for fake server timing out a context
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment