Skip to content

Commit

Permalink
fix: update comments
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Nov 29, 2024
1 parent 3bc343d commit 5d6c89e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/io/limitWriter_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright The Notary Project Authors.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package io

import (
Expand Down
4 changes: 4 additions & 0 deletions internal/io/limitwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package io provides a LimitWriter that writes to an underlying writer up to
// a limit.

package io

import "io"
Expand All @@ -31,6 +34,7 @@ func NewLimitWriter(w io.Writer, limit int64) *LimitWriter {
return &LimitWriter{w: w, limit: limit}
}

// Write writes p to the underlying writer up to the limit.
func (lw *LimitWriter) Write(p []byte) (int, error) {
remaining := lw.limit - lw.written
if remaining <= 0 {
Expand Down

0 comments on commit 5d6c89e

Please sign in to comment.