- ctxhttp - use HTTP clients but do requests timeouts with a context
- httptrace - a good library to pair with ctxhttp; you can use this to trace requests up to the server. this is pretty advanced usage, so I recommend you go here once you have basic performance issues sorted out
- fasthttp - slightly easier-to-use HTTP client. you still have to deal with connection pool details though. still useful if you like the API better
- go-cleanhttp - battle-tested HTTP client. useful to compare against the above code
- gorequest - nicer API, not as geared toward load testing. recommend against this for load tests, but for business logic it's good
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func newLogEntry(req *http.Request, lggr *log.Logger) logrus.Entry { | |
return lggr.WithFields(logrus.Fields{ | |
"http-method": req.Method, | |
"http-path": req.URL.Path, | |
"http-url": req.URL.String(), | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fans | |
// this code was inspired by https://talks.golang.org/2012/concurrency.slide#36 | |
// | |
// it uses the context package (which wasn't available when that presentation was made) instead of a timer to | |
// do timeouts | |
import ( | |
"context" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
make dev-teardown | |
export GO_BINARY_PATH=go1.11rc1 | |
make alldeps | |
# sleep a little more | |
sleep 5 | |
buffalo db create | |
buffalo db migrate up | |
make test-unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package actions | |
// this is a test method. It needs to have the prefix "Test" | |
func (a *ActionSuite) TestSomething() { | |
// this gives you one of these: https://godoc.org/github.com/stretchr/testify/require#Assertions | |
// | |
// you can also use a.Assert() to get one of these: https://godoc.org/github.com/stretchr/testify/assert#Assertions | |
r := a.Require() | |
// this gets you a completely empty DB with all the schemas and migrations already run on it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "OSBA (the broker for Azure) and service-catalog (the adapter for Kubernetes) are installed:" | |
helm list | |
echo "we also have a cool catalog of services we can create and hook up to:" | |
kubectl get clusterserviceclasses | |
echo "that's lame ... let's use svcat to see a friendly version:" | |
svcat get classes |
This PR was merged on July 19, 2017: kubernetes-retired/service-catalog#1050.
In the thread on that PR, both jdumars and I suggested that we try the change out and then have a retrospective on how that change has affected:
- Our ability to actively get a PR merged
- The quality of the project over the month of the LGTM policy as of this PR
I'll be facilitating an initial 15 minute retrospective.
If you have opinions on either of those topics, please bring them to present at this meeting. I am going to focus this discussion on opinions backed up with data that show trends over the 7/19 - 8/17 time frame.
metadata:
name: my-binding
namespace: default
finalizers:
- kubernetes # a default
- something.deis.io/a # custom
- something.deis.io/b # custom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i := 0 | |
for { | |
select { | |
case <- timer.C: | |
return | |
case <-ticker.C: | |
fn(i) | |
i++ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"time" | |
) | |
type acker struct { | |
ch chan time.Duration | |
} |