You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2022/09/17 04:33:54 UTC

[skywalking-eyes] branch main updated: dep: do not write license files if they already exist (#140)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git


The following commit(s) were added to refs/heads/main by this push:
     new d38fe05  dep: do not write license files if they already exist (#140)
d38fe05 is described below

commit d38fe0561d1140b010bddccb5fbfa3db7c12caf1
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sat Sep 17 12:33:50 2022 +0800

    dep: do not write license files if they already exist (#140)
---
 commands/deps_resolve.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/commands/deps_resolve.go b/commands/deps_resolve.go
index cc4d00c..a130377 100644
--- a/commands/deps_resolve.go
+++ b/commands/deps_resolve.go
@@ -114,6 +114,10 @@ var DepsResolveCommand = &cobra.Command{
 func writeLicense(result *deps.Result) {
 	filename := string(fileNamePattern.ReplaceAll([]byte(result.Dependency), []byte("-")))
 	filename = filepath.Join(outDir, "license-"+filename+".txt")
+	if _, err := os.Stat(filename); err == nil {
+		logger.Log.Debugf("File already exists, skipping: %s", filename)
+		return
+	}
 	file, err := os.Create(filename)
 	if err != nil {
 		logger.Log.Errorf("failed to create license file %v: %v", filename, err)