Skip to content

Commit d53c7b4

Browse files
authored
fix: add ScanWithParameters and deprecate ScanParameters. (#43)
`ScanWithParameters` is coherent with `ScanFileWithParameters`, while `ScanParameters` is not. The intentionality is also clearer with the new name.
1 parent 3442c47 commit d53c7b4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

filescan.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,24 @@ func (s *FileScanner) scanWithParameters(
152152
return analysis, nil
153153
}
154154

155-
// ScanParameters sends a file to VirusTotal for scanning. The file content is
155+
// Deprecated: Use ScanWithParameters instead.
156+
//
157+
// This function is kept for backward compatibility, but for cohereence with
158+
// the rest of the library is has been renamed to ScanWithParameters.
159+
func (s *FileScanner) ScanParameters(
160+
r io.Reader, filename string, progress chan<- float32, parameters map[string]string) (*Object, error) {
161+
return s.scanWithParameters(r, filename, progress, parameters)
162+
}
163+
164+
// ScanWithParameters sends a file to VirusTotal for scanning. The file content is
156165
// read from the r io.Reader and sent to VirusTotal with the provided file name
157166
// which can be left blank. The function also sends a float32 through the
158167
// progress channel indicating the percentage of the file that has been already
159168
// uploaded. The progress channel can be nil if the caller is not interested in
160169
// receiving upload progress updates. An analysis object is returned as soon as
161170
// the file is uploaded. Additional parameters can be passed to the scan
162171
// by using the parameters map[string]string argument.
163-
func (s *FileScanner) ScanParameters(
172+
func (s *FileScanner) ScanWithParameters(
164173
r io.Reader, filename string, progress chan<- float32, parameters map[string]string) (*Object, error) {
165174
return s.scanWithParameters(r, filename, progress, parameters)
166175
}

0 commit comments

Comments
 (0)