aboutsummaryrefslogtreecommitdiff
path: root/lib/http/endpoint_response_example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-02-25 19:36:18 +0700
committerShulhan <ms@kilabit.info>2023-02-25 19:56:24 +0700
commitfee20f0aeb51113a995c8fe21ff1e34f4244eb8f (patch)
tree79e25493dde2931cefa5fbb812717355bcef8cce /lib/http/endpoint_response_example_test.go
parent4100f2dbd433ec885c3c9f5eb963ba98bb1ab1e4 (diff)
downloadpakakeh.go-fee20f0aeb51113a995c8fe21ff1e34f4244eb8f.tar.xz
all: access embedded field or methods using the type name
This is for clarity in the code, better to be explicit by typing where the field or methods come from.
Diffstat (limited to 'lib/http/endpoint_response_example_test.go')
-rw-r--r--lib/http/endpoint_response_example_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/http/endpoint_response_example_test.go b/lib/http/endpoint_response_example_test.go
index f0bbec6d..91829346 100644
--- a/lib/http/endpoint_response_example_test.go
+++ b/lib/http/endpoint_response_example_test.go
@@ -38,17 +38,17 @@ func ExampleEndpointResponse() {
res := &EndpointResponse{}
id := epr.HttpRequest.Form.Get("id")
if len(id) == 0 {
- res.Code = http.StatusBadRequest
- res.Message = "empty parameter id"
+ res.E.Code = http.StatusBadRequest
+ res.E.Message = "empty parameter id"
return nil, res
}
if id == "0" {
// If the EndpointResponse.Code is 0, it will
// default to http.StatusInternalServerError
- res.Message = "id value 0 cause internal server error"
+ res.E.Message = "id value 0 cause internal server error"
return nil, res
}
- res.Code = http.StatusOK
+ res.E.Code = http.StatusOK
res.Data = &myData{
ID: id,
}