Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
api-load
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
demo
api-load
Commits
a220dfa9
Commit
a220dfa9
authored
Jan 19, 2021
by
barnettZQG
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parents
Pipeline
#682
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
0 deletions
+43
-0
settings.json
.vscode/settings.json
+4
-0
go.mod
go.mod
+5
-0
go.sum
go.sum
+7
-0
main.go
main.go
+27
-0
No files found.
.vscode/settings.json
0 → 100644
View file @
a220dfa9
{
"go.inferGopath"
:
false
}
\ No newline at end of file
go.mod
0 → 100644
View file @
a220dfa9
module goodrain.com/api-load
go 1.15
require github.com/sirupsen/logrus v1.7.0 // indirect
go.sum
0 → 100644
View file @
a220dfa9
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
main.go
0 → 100644
View file @
a220dfa9
package
main
import
(
"net/http"
"os"
"strconv"
"time"
"github.com/sirupsen/logrus"
)
func
main
()
{
var
sleep
=
os
.
Getenv
(
"SLEEP"
)
sleepInt
,
_
:=
strconv
.
Atoi
(
sleep
)
if
sleepInt
==
0
{
sleepInt
=
3
}
var
i
=
0
http
.
HandleFunc
(
"/api"
,
func
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
sleepInt
))
logrus
.
Infof
(
"receive request %d"
,
i
)
rw
.
Write
([]
byte
(
"Hello word"
))
i
++
})
logrus
.
Info
(
"server listen"
)
http
.
ListenAndServe
(
":9000"
,
nil
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment