Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Updated packages
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOaks committed Jul 14, 2017
1 parent 1259bb5 commit 0780e4f
Show file tree
Hide file tree
Showing 77 changed files with 11,172 additions and 9,278 deletions.
7 changes: 7 additions & 0 deletions github.com/gorilla/mux/mux.go
Expand Up @@ -176,6 +176,13 @@ func (r *Router) UseEncodedPath() *Router {
// parentRoute
// ----------------------------------------------------------------------------

func (r *Router) getBuildScheme() string {
if r.parent != nil {
return r.parent.getBuildScheme()
}
return ""
}

// getNamedRoutes returns the map where named routes are registered.
func (r *Router) getNamedRoutes() map[string]*Route {
if r.namedRoutes == nil {
Expand Down
22 changes: 22 additions & 0 deletions github.com/gorilla/mux/mux_test.go
Expand Up @@ -1215,6 +1215,28 @@ func TestSubRouter(t *testing.T) {
pathTemplate: `/{category}`,
shouldMatch: true,
},
{
title: "Build with scheme on parent router",
route: new(Route).Schemes("ftp").Host("google.com").Subrouter().Path("/"),
request: newRequest("GET", "ftp://google.com/"),
scheme: "ftp",
host: "google.com",
path: "/",
pathTemplate: `/`,
hostTemplate: `google.com`,
shouldMatch: true,
},
{
title: "Prefer scheme on child route when building URLs",
route: new(Route).Schemes("https", "ftp").Host("google.com").Subrouter().Schemes("ftp").Path("/"),
request: newRequest("GET", "ftp://google.com/"),
scheme: "ftp",
host: "google.com",
path: "/",
pathTemplate: `/`,
hostTemplate: `google.com`,
shouldMatch: true,
},
}

for _, test := range tests {
Expand Down
19 changes: 15 additions & 4 deletions github.com/gorilla/mux/route.go
Expand Up @@ -488,8 +488,8 @@ func (r *Route) URL(pairs ...string) (*url.URL, error) {
return nil, err
}
scheme = "http"
if r.buildScheme != "" {
scheme = r.buildScheme
if s := r.getBuildScheme(); s != "" {
scheme = s
}
}
if r.regexp.path != nil {
Expand Down Expand Up @@ -534,8 +534,8 @@ func (r *Route) URLHost(pairs ...string) (*url.URL, error) {
Scheme: "http",
Host: host,
}
if r.buildScheme != "" {
u.Scheme = r.buildScheme
if s := r.getBuildScheme(); s != "" {
u.Scheme = s
}
return u, nil
}
Expand Down Expand Up @@ -649,11 +649,22 @@ func (r *Route) buildVars(m map[string]string) map[string]string {

// parentRoute allows routes to know about parent host and path definitions.
type parentRoute interface {
getBuildScheme() string
getNamedRoutes() map[string]*Route
getRegexpGroup() *routeRegexpGroup
buildVars(map[string]string) map[string]string
}

func (r *Route) getBuildScheme() string {
if r.buildScheme != "" {
return r.buildScheme
}
if r.parent != nil {
return r.parent.getBuildScheme()
}
return ""
}

// getNamedRoutes returns the map where named routes are registered.
func (r *Route) getNamedRoutes() map[string]*Route {
if r.parent == nil {
Expand Down
2 changes: 1 addition & 1 deletion github.com/gorilla/websocket/doc.go
Expand Up @@ -33,7 +33,7 @@
// if err != nil {
// return
// }
// if err = conn.WriteMessage(messageType, p); err != nil {
// if err := conn.WriteMessage(messageType, p); err != nil {
// return err
// }
// }
Expand Down
2 changes: 1 addition & 1 deletion github.com/mattn/go-colorable/_example/logrus/main.go
@@ -1,8 +1,8 @@
package main

import (
"github.com/Sirupsen/logrus"
"github.com/mattn/go-colorable"
"github.com/sirupsen/logrus"
)

func main() {
Expand Down
26 changes: 15 additions & 11 deletions github.com/mattn/go-colorable/colorable_windows.go
Expand Up @@ -411,11 +411,6 @@ func (w *Writer) Write(data []byte) (n int, err error) {
var bw [1]byte
loop:
for {
r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
if r1 == 0 {
break loop
}

c1, err := er.ReadByte()
if err != nil {
break loop
Expand Down Expand Up @@ -460,37 +455,39 @@ loop:
if err != nil {
continue
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.y -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'B':
n, err = strconv.Atoi(buf.String())
if err != nil {
continue
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.y += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'C':
n, err = strconv.Atoi(buf.String())
if err != nil {
continue
}
csbi.cursorPosition.x -= short(n)
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'D':
n, err = strconv.Atoi(buf.String())
if err != nil {
continue
}
if n, err = strconv.Atoi(buf.String()); err == nil {
var csbi consoleScreenBufferInfo
csbi.cursorPosition.x += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'E':
n, err = strconv.Atoi(buf.String())
if err != nil {
continue
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = 0
csbi.cursorPosition.y += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
Expand All @@ -499,6 +496,7 @@ loop:
if err != nil {
continue
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = 0
csbi.cursorPosition.y -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
Expand All @@ -507,9 +505,11 @@ loop:
if err != nil {
continue
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = short(n - 1)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'H':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
if buf.Len() > 0 {
token := strings.Split(buf.String(), ";")
switch len(token) {
Expand Down Expand Up @@ -545,6 +545,7 @@ loop:
}
var count, written dword
var cursor coord
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
switch n {
case 0:
cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
Expand All @@ -566,6 +567,7 @@ loop:
continue
}
}
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
var cursor coord
switch n {
case 0:
Expand All @@ -580,6 +582,7 @@ loop:
procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
case 'm':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
attr := csbi.attributes
cs := buf.String()
if cs == "" {
Expand Down Expand Up @@ -700,6 +703,7 @@ loop:
procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
}
case 's':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
w.oldpos = csbi.cursorPosition
case 'u':
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
Expand Down
7 changes: 5 additions & 2 deletions github.com/stackimpact/stackimpact-go/README.md
Expand Up @@ -34,7 +34,7 @@ Linux, OS X or Windows. Go version 1.5+.

#### Create StackImpact account

Sign up for a free account at [stackimpact.com](https://stackimpact.com/).
[Sign up](https://dashboard.stackimpact.com/#/signup) for a free account (also with GitHub login).


#### Installing the agent
Expand All @@ -59,7 +59,10 @@ agent := stackimpact.Start(stackimpact.Options{
})
```

Other initialization options:
All initialization options:

* `AgentKey` (Required) The access key for communication with the StackImpact servers.
* `AppName` (Required) A name to identify and group application data. Typically, a single codebase corresponds to one application.
* `AppVersion` (Optional) Sets application version, which can be used to associate profiling information with the source code release.
* `AppEnvironment` (Optional) Used to differentiate applications in different environments.
* `HostName` (Optional) By default, host name will be the OS hostname.
Expand Down
8 changes: 4 additions & 4 deletions golang.org/x/crypto/acme/acme.go
Expand Up @@ -207,7 +207,7 @@ func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration,
return nil, "", responseError(res)
}

curl := res.Header.Get("location") // cert permanent URL
curl := res.Header.Get("Location") // cert permanent URL
if res.ContentLength == 0 {
// no cert in the body; poll until we get it
cert, err := c.FetchCert(ctx, curl, bundle)
Expand Down Expand Up @@ -240,7 +240,7 @@ func (c *Client) FetchCert(ctx context.Context, url string, bundle bool) ([][]by
if res.StatusCode > 299 {
return nil, responseError(res)
}
d := retryAfter(res.Header.Get("retry-after"), 3*time.Second)
d := retryAfter(res.Header.Get("Retry-After"), 3*time.Second)
select {
case <-time.After(d):
// retry
Expand Down Expand Up @@ -444,7 +444,7 @@ func (c *Client) WaitAuthorization(ctx context.Context, url string) (*Authorizat
if err != nil {
return nil, err
}
retry := res.Header.Get("retry-after")
retry := res.Header.Get("Retry-After")
if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusAccepted {
res.Body.Close()
if err := sleep(retry, 1); err != nil {
Expand Down Expand Up @@ -703,7 +703,7 @@ func (c *Client) retryPostJWS(ctx context.Context, key crypto.Signer, url string
// clear any nonces that we might've stored that might now be
// considered bad
c.clearNonces()
retry := res.Header.Get("retry-after")
retry := res.Header.Get("Retry-After")
if err := sleep(retry, 1); err != nil {
return nil, err
}
Expand Down

0 comments on commit 0780e4f

Please sign in to comment.