• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tensorchord / envd / 18149755418

01 Oct 2025 02:45AM UTC coverage: 42.475% (-0.3%) from 42.787%
18149755418

push

github

web-flow
chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 (#2034)

chore(deps): bump github.com/go-viper/mapstructure/v2

Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

5182 of 12200 relevant lines covered (42.48%)

165.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/app/formatter/data.go
1
// Copyright 2023 The envd Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package formatter
16

17
import (
18
        "fmt"
19
        "strings"
20
        "time"
21

22
        "github.com/docker/go-units"
23
        "github.com/pkg/errors"
24
        "github.com/urfave/cli/v2"
25

26
        "github.com/tensorchord/envd/pkg/envd"
27
        "github.com/tensorchord/envd/pkg/home"
28
        "github.com/tensorchord/envd/pkg/types"
29
)
30

31
var FormatFlag = cli.StringFlag{
32
        Name:     "format",
33
        Usage:    `Format of output, could be "json" or "table"`,
34
        Aliases:  []string{"f"},
35
        Value:    "table",
36
        Required: false,
37
        Action:   formatterValidator,
38
}
39

40
func formatterValidator(clicontext *cli.Context, v string) error {
×
41
        switch v {
×
42
        case
43
                "table",
44
                "json":
×
45
                return nil
×
46
        }
47
        return errors.Errorf(`Argument format only allows "json" and "table", found "%v"`, v)
×
48
}
49

50
func FormatEndpoint(env types.EnvdEnvironment) string {
×
51
        var res strings.Builder
×
52
        if env.Status.JupyterAddr != nil {
×
53
                res.WriteString(fmt.Sprintf("jupyter: %s", *env.Status.JupyterAddr))
×
54
        }
×
55
        if env.Status.RStudioServerAddr != nil {
×
56
                res.WriteString(fmt.Sprintf("rstudio: %s", *env.Status.RStudioServerAddr))
×
57
        }
×
58
        return res.String()
×
59
}
60

61
func GetDetailedVersion(clicontext *cli.Context) (DetailedVersion, error) {
×
62
        context, err := home.GetManager().ContextGetCurrent()
×
63
        if err != nil {
×
64
                return DetailedVersion{}, errors.Wrap(err, "failed to get the current context")
×
65
        }
×
66
        opt := envd.Options{
×
67
                Context: context,
×
68
        }
×
69
        engine, err := envd.New(clicontext.Context, opt)
×
70
        if err != nil {
×
71
                return DetailedVersion{}, errors.Wrap(
×
72
                        err, "failed to create engine for docker server",
×
73
                )
×
74
        }
×
75

76
        info, err := engine.GetInfo(clicontext.Context)
×
77
        if err != nil {
×
78
                return DetailedVersion{}, errors.Wrap(
×
79
                        err, "failed to get detailed version info from docker server",
×
80
                )
×
81
        }
×
82

83
        return DetailedVersion{
×
84
                OSVersion:         info.OSVersion,
×
85
                OSType:            info.OSType,
×
86
                KernelVersion:     info.KernelVersion,
×
87
                DockerVersion:     info.ServerVersion,
×
88
                Architecture:      info.Architecture,
×
89
                DefaultRuntime:    info.DefaultRuntime,
×
90
                ContainerRuntimes: GetRuntimes(info),
×
91
        }, nil
×
92
}
93

94
type DetailedVersion struct {
95
        OSVersion         string
96
        OSType            string
97
        KernelVersion     string
98
        Architecture      string
99
        DockerVersion     string
100
        ContainerRuntimes string
101
        DefaultRuntime    string
102
}
103

104
func GetRuntimes(info *types.EnvdInfo) string {
×
105
        runtimesMap := info.Runtimes
×
106
        keys := make([]string, 0, len(runtimesMap))
×
107
        for k := range runtimesMap {
×
108
                keys = append(keys, k)
×
109
        }
×
110
        return "[" + strings.Join(keys, ",") + "]"
×
111
}
112

113
func StringOrNone(target string) string {
×
114
        if target == "" {
×
115
                return "<none>"
×
116
        }
×
117
        return target
×
118
}
119

120
func CreatedSinceString(created int64) string {
×
121
        createdAt := time.Unix(created, 0)
×
122

×
123
        if createdAt.IsZero() {
×
124
                return ""
×
125
        }
×
126

127
        return units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
×
128
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc