This repository was archived by the owner on Jan 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 9
9
"os"
10
10
"os/signal"
11
11
"path/filepath"
12
+ "runtime/debug"
12
13
"strings"
13
14
"syscall"
14
15
"time"
@@ -21,10 +22,6 @@ import (
21
22
"go.containerssh.io/libcontainerssh/service"
22
23
)
23
24
24
- var (
25
- version = "0.5.0"
26
- )
27
-
28
25
// Main is a helper function to start a standard ContainerSSH instance. It should be used as the outer-most function
29
26
// and should never be used as an embedding technique.
30
27
func Main () {
@@ -326,8 +323,18 @@ func healthCheck(cfg config.AppConfig, logger log.Logger) error {
326
323
327
324
func printVersion (writer io.Writer ) error {
328
325
var buffer bytes.Buffer
329
- buffer .WriteString ("v" )
330
- buffer .WriteString (version )
326
+ var libcontainersshVersion string
327
+ bi , ok := debug .ReadBuildInfo ()
328
+ if ! ok {
329
+ return fmt .Errorf ("read build info %t" , ok )
330
+ }
331
+ for _ , dep := range bi .Deps {
332
+ if dep .Path == "go.containerssh.io/libcontainerssh" {
333
+ libcontainersshVersion = dep .Version
334
+ }
335
+ }
336
+ buffer .WriteString ("libcontainerssh version " )
337
+ buffer .WriteString (libcontainersshVersion )
331
338
buffer .WriteString ("\n " )
332
339
if _ , err := writer .Write (buffer .Bytes ()); err != nil {
333
340
return fmt .Errorf ("failed to write Version information (%w)" , err )
You can’t perform that action at this time.
0 commit comments