From 5d6c89e37407399397d16335bc105b77d488fedc Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Fri, 29 Nov 2024 08:06:15 +0000 Subject: [PATCH] fix: update comments Signed-off-by: Junjie Gao --- internal/io/limitWriter_test.go | 13 +++++++++++++ internal/io/limitwriter.go | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/internal/io/limitWriter_test.go b/internal/io/limitWriter_test.go index ef241c58..4a190614 100644 --- a/internal/io/limitWriter_test.go +++ b/internal/io/limitWriter_test.go @@ -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 ( diff --git a/internal/io/limitwriter.go b/internal/io/limitwriter.go index 102dee19..c48b8586 100644 --- a/internal/io/limitwriter.go +++ b/internal/io/limitwriter.go @@ -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" @@ -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 {