Skip to content

Commit 1d235c8

Browse files
committed
Fix linting issues
1 parent f6f961f commit 1d235c8

File tree

5 files changed

+11
-27
lines changed

5 files changed

+11
-27
lines changed

tpm/debug/bin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ func NewBinTap(w io.Writer) Tap {
2222
return &binTap{w: w}
2323
}
2424

25-
func (w *binTap) Write(data []byte) (int, error) {
26-
w.Lock()
27-
defer w.Unlock()
25+
func (t *binTap) Write(data []byte) (int, error) {
26+
t.Lock()
27+
defer t.Unlock()
2828

29-
return w.w.Write(data)
29+
return t.w.Write(data)
3030
}

tpm/debug/pcap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const snapLen = uint32(65536)
9494
var once sync.Once
9595
var headerWriteError error
9696

97-
func write(w *pcapgo.Writer, data []byte, in bool, inSeq uint32, outSeq uint32) error {
97+
func write(w *pcapgo.Writer, data []byte, in bool, inSeq, outSeq uint32) error {
9898
var tcpLayer = &layers.TCP{Window: 16}
9999
if in {
100100
tcpLayer.SrcPort = layers.TCPPort(2321)

tpm/debug/tap.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ type tap struct {
1414
out io.Writer
1515
}
1616

17-
func (t tap) Rx() io.Writer {
17+
func (t *tap) Rx() io.Writer {
1818
return t.in
1919
}
2020

21-
func (t tap) Tx() io.Writer {
21+
func (t *tap) Tx() io.Writer {
2222
return t.out
2323
}
2424

25-
func NewTap(rx io.Writer, tx io.Writer) Tap {
25+
func NewTap(rx, tx io.Writer) Tap {
2626
return &tap{
2727
in: rx,
2828
out: tx,

tpm/debug/text.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type wrapper struct {
1919

2020
func (w *wrapper) Write(data []byte) (int, error) {
2121
if w.in {
22-
return w.w.Write([]byte(fmt.Sprintf("<- %x\n", data)))
23-
} else {
24-
return w.w.Write([]byte(fmt.Sprintf("-> %x\n", data)))
22+
return fmt.Fprintf(w.w, "<- %x\n", data)
2523
}
24+
25+
return fmt.Fprintf(w.w, "-> %x\n", data)
2626
}

tpm/tpm.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,6 @@ func (t *TPM) initializeCommandChannel() error {
318318
}
319319
}
320320

321-
// if t.tap != nil && runtime.GOOS != "windows" {
322-
// if t.commandChannel == nil {
323-
// rwc, err := open.TPM(t.deviceName)
324-
// if err != nil {
325-
// return fmt.Errorf("failed opening TPM: %w", err)
326-
// }
327-
// //cc := interceptor.RWCFromTap(t.tap).Wrap(rwc)
328-
// //at = inject.Inject(interceptor.RWCFromTap(t.tap).Wrap(rwc)) // TODO: can we circumvent inject?
329-
// //t.attestConfig.CommandChannel = cc
330-
// cc := &linuxCmdChannel{rwc}
331-
// t.tappedChannel = interceptor.CommandChannelFromTap(t.tap).Wrap(cc)
332-
// } else {
333-
// t.tappedChannel = interceptor.CommandChannelFromTap(t.tap).Wrap(t.commandChannel)
334-
// }
335-
// }
336-
337321
// update `attestConfig` with the command channel, so that it is used whenever
338322
// attestation operations are being performed. Note that the command channel can
339323
// still be nil. It simply won't be used (wrapped) by `go-attestation` in that case.

0 commit comments

Comments
 (0)