mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-17 04:50:02 +02:00
Replace local pid module with the one located at github.com/eosswedenorg-go/pid
This commit is contained in:
parent
10a12816fa
commit
59bd699065
5 changed files with 7 additions and 38 deletions
8
go.mod
8
go.mod
|
|
@ -5,11 +5,11 @@ go 1.14
|
|||
require (
|
||||
internal/eosapi v1.0.0
|
||||
internal/log v1.0.0
|
||||
internal/pid v1.0.0
|
||||
internal/utils v1.0.0
|
||||
|
||||
github.com/eosswedenorg-go/haproxy v0.0.0-20220101140534-fccfdd93a8cd
|
||||
github.com/firstrow/tcp_server v0.1.0
|
||||
github.com/eosswedenorg-go/pid v1.0.0
|
||||
github.com/eosswedenorg-go/haproxy v0.0.0-20220101140534-fccfdd93a8cd
|
||||
github.com/firstrow/tcp_server v0.1.0
|
||||
github.com/pborman/getopt/v2 v2.1.0
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +17,4 @@ replace internal/eosapi => ./src/eosapi
|
|||
|
||||
replace internal/log => ./src/log
|
||||
|
||||
replace internal/pid => ./src/pid
|
||||
|
||||
replace internal/utils => ./src/utils
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eosswedenorg-go/haproxy v0.0.0-20220101140534-fccfdd93a8cd h1:e59v3HnnG60uE50OtziOxyiSNDADr1lDbzn33btn3yE=
|
||||
github.com/eosswedenorg-go/haproxy v0.0.0-20220101140534-fccfdd93a8cd/go.mod h1:l5DTEb0dcTZyATo2cuaYQPqwBRuzDw0UgupNo8SAgXo=
|
||||
github.com/eosswedenorg-go/pid v1.0.0 h1:k1ra19cgWBHnX5gWQq+eUhNHIjT7hdhsYGp+Ovfvd2U=
|
||||
github.com/eosswedenorg-go/pid v1.0.0/go.mod h1:c9nVBDmo8pa3dVjrZjDUN4/DT1ChmfuCWXt6lHsagRc=
|
||||
github.com/firstrow/tcp_server v0.1.0 h1:SeaKjoPUqSgwb8NLbXtcWEQS1H+QZ2hwPBBLd1TnGo4=
|
||||
github.com/firstrow/tcp_server v0.1.0/go.mod h1:Yw3e670k1AHRzhd+WrOEvXLCMh5NDH01Kc/o0QR1GVQ=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os/signal"
|
||||
"syscall"
|
||||
"internal/log"
|
||||
"internal/pid"
|
||||
"github.com/eosswedenorg-go/pid"
|
||||
"github.com/pborman/getopt/v2"
|
||||
)
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ func main() {
|
|||
|
||||
if len(pidFile) > 0 {
|
||||
log.Info("Writing pidfile: %s", pidFile)
|
||||
_, err := pid.Save(pidFile)
|
||||
err := pid.Save(pidFile)
|
||||
if err != nil {
|
||||
log.Error("Failed to write pidfile: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
module internal/pid
|
||||
|
||||
go 1.14
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
package pid
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Get() (int) {
|
||||
return os.Getpid()
|
||||
}
|
||||
|
||||
func Save(path string) (int, error) {
|
||||
|
||||
pid := Get()
|
||||
fd, err := os.Create(path)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
_, err = fd.WriteString(strconv.Itoa(pid))
|
||||
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return pid, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue