File tree 6 files changed +106
-0
lines changed
6 files changed +106
-0
lines changed Original file line number Diff line number Diff line change 3
3
use (
4
4
./closer
5
5
./ctxkey
6
+ ./proto
6
7
./time
7
8
)
Original file line number Diff line number Diff line change 1
1
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w =
2
+ github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4 =
3
+ github.com/golang/protobuf v1.5.0 /go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk =
4
+ github.com/google/go-cmp v0.5.5 /go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE =
2
5
github.com/kr/pretty v0.1.0 /go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo =
6
+ github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw =
7
+ github.com/kr/pty v1.1.1 /go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ =
8
+ github.com/kr/text v0.1.0 /go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI =
3
9
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY =
10
+ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
4
11
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
Original file line number Diff line number Diff line change
1
+ output :
2
+ formats :
3
+ - format : colored-line-number
4
+ print-issued-lines : true
5
+ print-linter-name : true
6
+
7
+ linters-settings :
8
+ gocognit :
9
+ min-complexity : 10
10
+ goconst :
11
+ min-len : 2
12
+ min-occurrences : 2
13
+ gosec :
14
+ excludes :
15
+ # _ instead of err checks
16
+ - G104
17
+ govet :
18
+ enable-all : true
19
+ nakedret :
20
+ max-func-lines : 10
21
+ nolintlint :
22
+ require-specific : true
23
+ prealloc :
24
+ range-loops : true
25
+ revive :
26
+ rules :
27
+ - name : unexported-return
28
+ disabled : true
29
+ staticcheck :
30
+ # SA5001: Allow to ignore returned error before deferring *.Close()
31
+ checks : ["all", "-SA5001"]
32
+
33
+ linters :
34
+ disable-all : true
35
+ enable :
36
+ - bodyclose
37
+ - errcheck
38
+ - errorlint
39
+ - exportloopref
40
+ - gocheckcompilerdirectives
41
+ - gocognit
42
+ - goconst
43
+ - goimports
44
+ - gosec
45
+ - gosimple
46
+ - govet
47
+ - ineffassign
48
+ - makezero
49
+ - mnd
50
+ - nakedret
51
+ - noctx
52
+ - nolintlint
53
+ - nosprintfhostport
54
+ - prealloc
55
+ - revive
56
+ - staticcheck
57
+ - tenv
58
+ - testpackage
59
+ - typecheck
60
+ - unconvert
61
+ - unused
62
+ - wastedassign
63
+
64
+ issues :
65
+ exclude-rules :
66
+ - path : ' (.+)_test\.go'
67
+ linters :
68
+ - gocognit
Original file line number Diff line number Diff line change
1
+ module git.tprs.ru/pl-go/pkg/proto
2
+
3
+ go 1.20
4
+
5
+ require google.golang.org/protobuf v1.34.2
Original file line number Diff line number Diff line change
1
+ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU =
2
+ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4 =
3
+ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg =
4
+ google.golang.org/protobuf v1.34.2 /go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw =
Original file line number Diff line number Diff line change
1
+ package proto
2
+
3
+ import (
4
+ "time"
5
+
6
+ "google.golang.org/protobuf/types/known/timestamppb"
7
+ )
8
+
9
+ // Ptr constructs a pointer to the value of any type.
10
+ func Ptr [T any ](v T ) * T {
11
+ return & v
12
+ }
13
+
14
+ // FromTimePtr constructs an instance of timestamppb.Timestamp from the provided time.Time.
15
+ // If the nil has passed, then the nil will be returned.
16
+ func FromTimePtr (t * time.Time ) * timestamppb.Timestamp {
17
+ if t == nil {
18
+ return nil
19
+ }
20
+ return timestamppb .New (* t )
21
+ }
You can’t perform that action at this time.
0 commit comments