diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2018-05-21 14:34:20 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-05-21 15:34:20 +0300 |
commit | 3f3383dc0a0de9d6a0444bba71603e5c5d248f0b (patch) | |
tree | 34f4f2ad9ce686d265c2f81e6a3e1b02b92e8e22 /vendor/github.com/facebookgo | |
parent | d7fd9bf7bb25e7537aef335a0927c216aed881a3 (diff) | |
download | gitea-3f3383dc0a0de9d6a0444bba71603e5c5d248f0b.tar.gz gitea-3f3383dc0a0de9d6a0444bba71603e5c5d248f0b.zip |
Migrate to dep (#3972)
* Update makefile to use dep
* Migrate to dep
* Fix some deps
* Try to find a better version for golang.org/x/net
* Try to find a better version for golang.org/x/oauth2
Diffstat (limited to 'vendor/github.com/facebookgo')
-rw-r--r-- | vendor/github.com/facebookgo/clock/README.md | 104 | ||||
-rw-r--r-- | vendor/github.com/facebookgo/httpdown/readme.md | 41 | ||||
-rw-r--r-- | vendor/github.com/facebookgo/stats/readme.md | 4 |
3 files changed, 0 insertions, 149 deletions
diff --git a/vendor/github.com/facebookgo/clock/README.md b/vendor/github.com/facebookgo/clock/README.md deleted file mode 100644 index 5d4f4fe72e..0000000000 --- a/vendor/github.com/facebookgo/clock/README.md +++ /dev/null @@ -1,104 +0,0 @@ -clock [](https://drone.io/github.com/benbjohnson/clock/latest) [](https://coveralls.io/r/benbjohnson/clock?branch=master) [](https://godoc.org/github.com/benbjohnson/clock)  -===== - -Clock is a small library for mocking time in Go. It provides an interface -around the standard library's [`time`][time] package so that the application -can use the realtime clock while tests can use the mock clock. - -[time]: http://golang.org/pkg/time/ - - -## Usage - -### Realtime Clock - -Your application can maintain a `Clock` variable that will allow realtime and -mock clocks to be interchangable. For example, if you had an `Application` type: - -```go -import "github.com/benbjohnson/clock" - -type Application struct { - Clock clock.Clock -} -``` - -You could initialize it to use the realtime clock like this: - -```go -var app Application -app.Clock = clock.New() -... -``` - -Then all timers and time-related functionality should be performed from the -`Clock` variable. - - -### Mocking time - -In your tests, you will want to use a `Mock` clock: - -```go -import ( - "testing" - - "github.com/benbjohnson/clock" -) - -func TestApplication_DoSomething(t *testing.T) { - mock := clock.NewMock() - app := Application{Clock: mock} - ... -} -``` - -Now that you've initialized your application to use the mock clock, you can -adjust the time programmatically. The mock clock always starts from the Unix -epoch (midnight, Jan 1, 1970 UTC). - - -### Controlling time - -The mock clock provides the same functions that the standard library's `time` -package provides. For example, to find the current time, you use the `Now()` -function: - -```go -mock := clock.NewMock() - -// Find the current time. -mock.Now().UTC() // 1970-01-01 00:00:00 +0000 UTC - -// Move the clock forward. -mock.Add(2 * time.Hour) - -// Check the time again. It's 2 hours later! -mock.Now().UTC() // 1970-01-01 02:00:00 +0000 UTC -``` - -Timers and Tickers are also controlled by this same mock clock. They will only -execute when the clock is moved forward: - -``` -mock := clock.NewMock() -count := 0 - -// Kick off a timer to increment every 1 mock second. -go func() { - ticker := clock.Ticker(1 * time.Second) - for { - <-ticker.C - count++ - } -}() -runtime.Gosched() - -// Move the clock forward 10 second. -mock.Add(10 * time.Second) - -// This prints 10. -fmt.Println(count) -``` - - diff --git a/vendor/github.com/facebookgo/httpdown/readme.md b/vendor/github.com/facebookgo/httpdown/readme.md deleted file mode 100644 index d5fa245dbc..0000000000 --- a/vendor/github.com/facebookgo/httpdown/readme.md +++ /dev/null @@ -1,41 +0,0 @@ -httpdown [](https://travis-ci.org/facebookgo/httpdown) -======== - -Documentation: https://godoc.org/github.com/facebookgo/httpdown - -Package httpdown provides a library that makes it easy to build a HTTP server -that can be shutdown gracefully (that is, without dropping any connections). - -If you want graceful restart and not just graceful shutdown, look at the -[grace](https://github.com/facebookgo/grace) package which uses this package -underneath but also provides graceful restart. - -Usage ------ - -Demo HTTP Server with graceful termination: -https://github.com/facebookgo/httpdown/blob/master/httpdown_example/main.go - -1. Install the demo application - - go get github.com/facebookgo/httpdown/httpdown_example - -1. Start it in the first terminal - - httpdown_example - - This will output something like: - - 2014/11/18 21:57:50 serving on http://127.0.0.1:8080/ with pid 17 - -1. In a second terminal start a slow HTTP request - - curl 'http://localhost:8080/?duration=20s' - -1. In a third terminal trigger a graceful shutdown (using the pid from your output): - - kill -TERM 17 - -This will demonstrate that the slow request was served before the server was -shutdown. You could also have used `Ctrl-C` instead of `kill` as the example -application triggers graceful shutdown on TERM or INT signals. diff --git a/vendor/github.com/facebookgo/stats/readme.md b/vendor/github.com/facebookgo/stats/readme.md deleted file mode 100644 index f268ed307b..0000000000 --- a/vendor/github.com/facebookgo/stats/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -stats [](https://travis-ci.org/facebookgo/stats) -===== - -Documentation: https://godoc.org/github.com/facebookgo/stats |