• 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

77.23
/pkg/app/formatter/table/env.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 table
16

17
import (
18
        "fmt"
19
        "io"
20
        "strconv"
21

22
        "github.com/cockroachdb/errors"
23
        "github.com/olekukonko/tablewriter"
24
        "github.com/olekukonko/tablewriter/renderer"
25
        "github.com/olekukonko/tablewriter/tw"
26

27
        "github.com/tensorchord/envd/pkg/app/formatter"
28
        "github.com/tensorchord/envd/pkg/types"
29
)
30

31
func RenderEnvironments(w io.Writer, envs []types.EnvdEnvironment) error {
1✔
32
        table := CreateTable(w)
1✔
33
        table.Header([]string{
1✔
34
                "Name", "Endpoint", "SSH Target", "Image",
1✔
35
                "GPU", "CUDA", "CUDNN", "Status",
1✔
36
        })
1✔
37

1✔
38
        for _, env := range envs {
1✔
39
                envRow := make([]string, 9)
×
40
                envRow[0] = env.Name
×
41
                envRow[1] = formatter.FormatEndpoint(env)
×
42
                envRow[2] = fmt.Sprintf("%s.envd", env.Name)
×
43
                envRow[3] = env.Spec.Image
×
44
                envRow[4] = strconv.FormatBool(env.GPU)
×
45
                envRow[5] = formatter.StringOrNone(env.CUDA)
×
46
                envRow[6] = formatter.StringOrNone(env.CUDNN)
×
47
                envRow[7] = env.Status.Phase
×
48
                err := table.Append(envRow)
×
49
                if err != nil {
×
50
                        return errors.Wrapf(err, "failed to append row for environment %s", env.Name)
×
51
                }
×
52
        }
53
        return errors.Wrap(table.Render(), "failed to render environment table")
1✔
54
}
55

56
func RenderPortBindings(w io.Writer, ports []types.PortBinding) error {
1✔
57
        if ports == nil {
1✔
58
                return nil
×
59
        }
×
60
        table := CreateTable(w)
1✔
61
        table.Header([]string{"Name", "Container Port", "Protocol", "Host IP", "Host Port"})
1✔
62
        for _, port := range ports {
2✔
63
                row := make([]string, 5)
1✔
64
                row[0] = port.Name
1✔
65
                row[1] = port.Port
1✔
66
                row[2] = port.Protocol
1✔
67
                row[3] = port.HostIP
1✔
68
                row[4] = port.HostPort
1✔
69
                err := table.Append(row)
1✔
70
                if err != nil {
1✔
71
                        return errors.Wrapf(err, "failed to append row for port binding %s", port.Name)
×
72
                }
×
73
        }
74
        return errors.Wrap(table.Render(), "failed to render port bindings table")
1✔
75
}
76

77
func RenderDependencies(w io.Writer, dep *types.Dependency) error {
1✔
78
        if dep == nil {
1✔
79
                return nil
×
80
        }
×
81
        table := CreateTable(w)
1✔
82
        table.Header([]string{"Dependencies", "Type"})
1✔
83
        for _, p := range dep.PyPIPackages {
2✔
84
                envRow := make([]string, 2)
1✔
85
                envRow[0] = p
1✔
86
                envRow[1] = "Python"
1✔
87
                err := table.Append(envRow)
1✔
88
                if err != nil {
1✔
89
                        return errors.Wrapf(err, "failed to append row for Python package %s", p)
×
90
                }
×
91
        }
92
        for _, p := range dep.APTPackages {
2✔
93
                envRow := make([]string, 2)
1✔
94
                envRow[0] = p
1✔
95
                envRow[1] = "APT"
1✔
96
                err := table.Append(envRow)
1✔
97
                if err != nil {
1✔
98
                        return errors.Wrapf(err, "failed to append row for APT package %s", p)
×
99
                }
×
100
        }
101
        return errors.Wrap(table.Render(), "failed to render dependencies table")
1✔
102
}
103

104
func CreateTable(w io.Writer) *tablewriter.Table {
4✔
105
        table := tablewriter.NewTable(
4✔
106
                w,
4✔
107
                tablewriter.WithRowAutoWrap(tw.WrapNone),
4✔
108
                tablewriter.WithHeaderAutoFormat(tw.On),
4✔
109
                tablewriter.WithRenderer(renderer.NewBlueprint(
4✔
110
                        tw.Rendition{
4✔
111
                                Borders: tw.BorderNone,
4✔
112
                                Symbols: tw.NewSymbols(tw.StyleNone),
4✔
113
                                Settings: tw.Settings{
4✔
114
                                        Separators: tw.Separators{
4✔
115
                                                BetweenRows:    tw.Off,
4✔
116
                                                BetweenColumns: tw.Off,
4✔
117
                                        },
4✔
118
                                        Lines: tw.Lines{
4✔
119
                                                ShowHeaderLine: tw.Off,
4✔
120
                                        },
4✔
121
                                },
4✔
122
                        },
4✔
123
                )),
4✔
124
                tablewriter.WithConfig(
4✔
125
                        tablewriter.Config{
4✔
126
                                Header: tw.CellConfig{
4✔
127
                                        Alignment: tw.CellAlignment{
4✔
128
                                                Global: tw.AlignLeft,
4✔
129
                                        },
4✔
130
                                },
4✔
131
                                Row: tw.CellConfig{
4✔
132
                                        Alignment: tw.CellAlignment{
4✔
133
                                                Global: tw.AlignLeft,
4✔
134
                                        },
4✔
135
                                },
4✔
136
                        },
4✔
137
                ),
4✔
138
        )
4✔
139

4✔
140
        return table
4✔
141
}
4✔
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