Skip to content

Commit

Permalink
Merge pull request #157 from linkernetworks/sufuf3/fix-govet-misspell
Browse files Browse the repository at this point in the history
Fix misspell, go_vet & golint

Former-commit-id: 6ed8b25930bcd8756e4e81ec5903b8af2ee5f4c4 [formerly 6ed8b25930bcd8756e4e81ec5903b8af2ee5f4c4 [formerly d61cd1e]]
Former-commit-id: 14865ac6d7437fd4861b539b9684fcd0d3d0b457
Former-commit-id: 123139c
  • Loading branch information
John-Lin authored Jul 24, 2018
2 parents 8f9826b + 9ca55fe commit 6940aca
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/entity/metrics_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ContainerDetailMetrics struct {
Node string `json:"node"`
Image string `json:"image"`
Command []string `json:"command"`
vNIC string `json:"vNic"`
VNIC string `json:"vNic"`
}

// ContainerMetrics is the structure for Container Metrics
Expand Down
2 changes: 1 addition & 1 deletion src/entity/metrics_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ type ServiceMetrics struct {
Type string `json:"type"`
CreateAt int `json:"createAt"`
ClusterIP string `json:"clusterIP"`
Ports []v1.ServicePort `json: "ports"`
Ports []v1.ServicePort `json:"ports"`
Labels map[string]string `json:"labels"`
}
2 changes: 1 addition & 1 deletion src/entity/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PodNetwork struct {
Name string `bson:"name" json:"name"`
IfName string `bson:"ifName" json:"ifName"`
VlanTag *int32 `bson:"vlanTag" json:"vlanTag"`
IPAddress string `bson:"ipAddress json:"ipAddress"`
IPAddress string `bson:"ipAddress" json:"ipAddress"`
Netmask string `bson:"netmask" json:"netmask"`
BridgeName string `bson:"bridgeName" json:"bridgeName"` //its from the entity.Network entity
}
Expand Down
2 changes: 1 addition & 1 deletion src/errors/network.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package errors

// ErrInvalidVLAN is the sturcture
// ErrInvalidVLAN is the structure
type ErrInvalidVLAN struct {
message string
}
Expand Down
1 change: 0 additions & 1 deletion src/kubernetes/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ func (kc *KubeCtl) IsPodCompleted(pod *corev1.Pod) bool {
default:
return true
}
return true
}
4 changes: 2 additions & 2 deletions src/net/http/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestCompositeServiceHandler(t *testing.T) {
data := 0
var handler = func(*web.NativeContext) {
data += 1
data++
}

req, err := http.NewRequest("POST", "http://here.com/v1/signin", nil)
Expand All @@ -27,7 +27,7 @@ func TestCompositeServiceHandler(t *testing.T) {
func TestRESTfulServiceHandler(t *testing.T) {
data := 0
var handler = func(*web.Context) {
data += 1
data++
}

routeHandler := RESTfulServiceHandler(nil, handler)
Expand Down
24 changes: 12 additions & 12 deletions src/net/http/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
)

// The Structure to contain the Error Message from the HTTP response
// ErrorPayload is the Structure to contain the Error Message from the HTTP response
// Contains the Error Messagess (At most two errors)
type ErrorPayload struct {
XMLName xml.Name `json:"-" xml:"response"`
Expand All @@ -15,7 +15,7 @@ type ErrorPayload struct {
PreviousMessage string `json:"previousMessage,omitempty" xml:"previousMessage,omitempty"`
}

// Return the ErrorPayload message according the parameters (errors)
// NewErrorPayload will return the ErrorPayload message according the parameters (errors)
// The ErrorPayload contains at most error messages
func NewErrorPayload(errs ...error) ErrorPayload {
payload := ErrorPayload{Error: true}
Expand All @@ -30,7 +30,7 @@ func NewErrorPayload(errs ...error) ErrorPayload {
return payload
}

// The function to get the error from the request and ErrorPayload
// EncodeErrorPayload is the function to get the error from the request and ErrorPayload
// It should contains the errorType and error content
func EncodeErrorPayload(req *http.Request, payload ErrorPayload) (out []byte, contentType string, encErr error) {
contentType = req.Header.Get("content-type")
Expand All @@ -48,7 +48,7 @@ func EncodeErrorPayload(req *http.Request, payload ErrorPayload) (out []byte, co
return out, contentType, encErr
}

// Write the error status and error code to the http request and return the written byte count of the http request
// WriteStatusAndError will write the error status and error code to the http request and return the written byte count of the http request
func WriteStatusAndError(req *http.Request, resp http.ResponseWriter, status int, errs ...error) (int, error) {
payload := NewErrorPayload(errs...)
out, contentType, encErr := EncodeErrorPayload(req, payload)
Expand All @@ -62,42 +62,42 @@ func WriteStatusAndError(req *http.Request, resp http.ResponseWriter, status int
return resp.Write(out)
}

// Set the status code http.StatusForbidden to the HTTP response message
// Forbidden will set the status code http.StatusForbidden to the HTTP response message
func Forbidden(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusForbidden, errs...)
}

// Set the status code http.StatusBadRequest to the HTTP response message
// BadRequest will set the status code http.StatusBadRequest to the HTTP response message
func BadRequest(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusBadRequest, errs...)
}

// Set the status code http.StatusOK to the HTTP response message
// OK will set the status code http.StatusOK to the HTTP response message
func OK(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusOK, errs...)
}

// Set the status code http.StatusNotFound to the HTTP response message
// NotFound will set the status code http.StatusNotFound to the HTTP response message
func NotFound(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusNotFound, errs...)
}

// Set the status code http.StatusUnauthorized to the HTTP response message
// Unauthorized will set the status code http.StatusUnauthorized to the HTTP response message
func Unauthorized(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusUnauthorized, errs...)
}

// Set the status code http.StatusInternalServerError to the HTTP response message
// InternalServerError will set the status code http.StatusInternalServerError to the HTTP response message
func InternalServerError(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusInternalServerError, errs...)
}

// Set the status code http.StatusConflict to the HTTP response message
// Conflict will set the status code http.StatusConflict to the HTTP response message
func Conflict(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusConflict, errs...)
}

// Set the status code http.StatusUnprocessableEntity to the HTTP response message
// UnprocessableEntity will set the status code http.StatusUnprocessableEntity to the HTTP response message
func UnprocessableEntity(req *http.Request, resp http.ResponseWriter, errs ...error) (int, error) {
return WriteStatusAndError(req, resp, http.StatusUnprocessableEntity, errs...)
}

0 comments on commit 6940aca

Please sign in to comment.