From 0355ec6b216a9fff63031fbb6fafff110f05c096 Mon Sep 17 00:00:00 2001 From: hailaz <739476267@qq.com> Date: Fri, 19 Nov 2021 09:53:32 +0800 Subject: [PATCH] doc: add code comments --- os/gfile/gfile_z_example_contents_test.go | 3 ++- os/gfile/gfile_z_example_replace_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/os/gfile/gfile_z_example_contents_test.go b/os/gfile/gfile_z_example_contents_test.go index 7f13c6ae5..13e90500c 100644 --- a/os/gfile/gfile_z_example_contents_test.go +++ b/os/gfile/gfile_z_example_contents_test.go @@ -101,7 +101,8 @@ func ExamplePutContentsAppend() { // read contents fmt.Println(gfile.GetContents(tempFile)) - // write contents + // It creates and append content string into specifies file path. + // It automatically creates directory recursively if it does not exist. gfile.PutContentsAppend(tempFile, " append content") // read contents diff --git a/os/gfile/gfile_z_example_replace_test.go b/os/gfile/gfile_z_example_replace_test.go index d9c6935b7..df4d3a931 100644 --- a/os/gfile/gfile_z_example_replace_test.go +++ b/os/gfile/gfile_z_example_replace_test.go @@ -27,6 +27,7 @@ func ExampleReplaceFile() { // read contents fmt.Println(gfile.GetContents(tempFile)) + // It replaces content directly by file path. gfile.ReplaceFile("content", "replace word", tempFile) fmt.Println(gfile.GetContents(tempFile))