Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Dec 1, 2024
1 parent 0c6e5e2 commit b19568a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions clab/dependency_manager/dependency_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (d *DependencyNode) getExecs(stage types.WaitForStage, execPhase types.Exec
return nil, fmt.Errorf("stage %s unknown", stage)
}

var result = []*types.Exec{}
result := []*types.Exec{}
for _, x := range sb.Execs {
// filter the list of commands for the given phase (on-enter / on-exit)
if x.Phase == execPhase {
Expand Down Expand Up @@ -136,7 +136,6 @@ func (d *DependencyNode) runExecs(ctx context.Context, execPhase types.ExecPhase
execResultCollection.Add(hostname, execResult)
}
execResultCollection.Log()

}

// Done is called by a node that has finished all tasks for the provided stage.
Expand Down
3 changes: 2 additions & 1 deletion cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ func printContainerInspect(containers []runtime.GenericContainer, format string)
"Name",
"Kind/Image",
"State",
"IPv4/6 Address"}
"IPv4/6 Address",
}

if wide {
header = slices.Insert(header, 1, "Owner")
Expand Down
6 changes: 4 additions & 2 deletions cmd/tools_netem.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func init() {
netemSetCmd.Flags().Float64VarP(&netemLoss, "loss", "", 0,
"random packet loss expressed in percentage (e.g. 0.1 means 0.1%)")
netemSetCmd.Flags().Uint64VarP(&netemRate, "rate", "", 0, "link rate limit in kbit")
netemSetCmd.Flags().Float64VarP(&netemCorruption, "corruption", "", 0, "random packet corruption probability expressed in percentage (e.g. 0.1 means 0.1%)")
netemSetCmd.Flags().Float64VarP(&netemCorruption, "corruption", "", 0,
"random packet corruption probability expressed in percentage (e.g. 0.1 means 0.1%)")

netemSetCmd.MarkFlagRequired("node")
netemSetCmd.MarkFlagRequired("interface")
Expand Down Expand Up @@ -231,7 +232,8 @@ func qdiscToTableData(qdisc gotc.Object) tableWriter.Row {

loss = strconv.FormatFloat(float64(qdisc.Netem.Qopt.Loss)/float64(math.MaxUint32)*100, 'f', 2, 64) + "%"
rate = strconv.Itoa(int(qdisc.Netem.Rate.Rate * 8 / 1000))
corruption = strconv.FormatFloat(float64(qdisc.Netem.Corrupt.Probability)/float64(math.MaxUint32)*100, 'f', 2, 64) + "%"
corruption = strconv.FormatFloat(float64(qdisc.Netem.Corrupt.Probability)/
float64(math.MaxUint32)*100, 'f', 2, 64) + "%"

return tableWriter.Row{
ifDisplayName,
Expand Down
4 changes: 3 additions & 1 deletion internal/tc/tc.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func NewTC(ns int) (*tc.Tc, error) {
}

// SetImpairments sets the impairments on the given interface of a node.
func SetImpairments(tcnl *tc.Tc, nodeName string, link *net.Interface, delay, jitter time.Duration, loss float64, rate uint64, probability float64) (*tc.Object, error) {
func SetImpairments(tcnl *tc.Tc, nodeName string, link *net.Interface, delay, jitter time.Duration,
loss float64, rate uint64, probability float64,
) (*tc.Object, error) {
err := tcnl.SetOption(netlink.ExtendedAcknowledge, true)
if err != nil {
return nil, fmt.Errorf("could not set option ExtendedAcknowledge: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion nodes/rare/rare.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (n *rare) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
// make ipv6 disabled on all rare node interfaces unconditionally
// as ipv6 will be handled by rare/freertr
// The setting 'net.ipv6.conf.all.disable_ipv6' 1 - interferes with IPv6 out-of-band management. Commenting it out for now as a workaround.
// cfg.Sysctls["net.ipv6.conf.all.disable_ipv6"] = "1"
// cfg.Sysctls["net.ipv6.conf.all.disable_ipv6"] = "1"

n.Cfg.Binds = append(n.Cfg.Binds,
fmt.Sprint(filepath.Join(n.Cfg.LabDir, "run"), ":/rtr/run"),
Expand Down
6 changes: 3 additions & 3 deletions types/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
)

var (
// the defauts we need as pointers, so assign them to vars, such that we can acquire the pointer
// the defauts we need as pointers, so assign them to vars, such that we can acquire the pointer.
defaultCommandExecutionPhase = CommandExecutionPhaseEnter
defaultCommandTarget = CommandTargetContainer
)
Expand Down Expand Up @@ -180,9 +180,9 @@ const (
type ExecTarget string

const (
// CommandTargetContainer determines that the commands are meant to be executed within the container
// CommandTargetContainer determines that the commands are meant to be executed within the container.
CommandTargetContainer ExecTarget = "container"
// CommandTargetHost determines that the commands are meant to be executed on the host system
// CommandTargetHost determines that the commands are meant to be executed on the host system.
CommandTargetHost ExecTarget = "host"
)

Expand Down

0 comments on commit b19568a

Please sign in to comment.