Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package golang-github-linuxdeepin-go-lib for
openSUSE:Factory checked in at 2022-01-31 22:56:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-linuxdeepin-go-lib (Old)
and /work/SRC/openSUSE:Factory/.golang-github-linuxdeepin-go-lib.new.1898
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-github-linuxdeepin-go-lib"
Mon Jan 31 22:56:51 2022 rev:4 rq:950177 version:5.7.35
Changes:
--------
---
/work/SRC/openSUSE:Factory/golang-github-linuxdeepin-go-lib/golang-github-linuxdeepin-go-lib.changes
2021-08-16 10:14:19.562899623 +0200
+++
/work/SRC/openSUSE:Factory/.golang-github-linuxdeepin-go-lib.new.1898/golang-github-linuxdeepin-go-lib.changes
2022-01-31 22:57:15.249608946 +0100
@@ -1,0 +2,19 @@
+Thu Dec 16 04:14:30 UTC 2021 - Hillwood Yang <[email protected]>
+
+- Update version to 5.7.35
+ * Fix bugs
+
+-------------------------------------------------------------------
+Wed Oct 27 13:31:26 UTC 2021 - Hillwood Yang <[email protected]>
+
+- Fix build on Leap 15.4+
+
+-------------------------------------------------------------------
+Sun Oct 24 03:05:29 UTC 2021 - Hillwood Yang <[email protected]>
+
+- Update version to 5.7.15
+ * Add SyncWriteFile
+ * Add BindTextdomainCodeset
+ * Fix Mock
+
+-------------------------------------------------------------------
Old:
----
go-lib-5.7.10.tar.gz
New:
----
go-lib-5.7.35.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-github-linuxdeepin-go-lib.spec ++++++
--- /var/tmp/diff_new_pack.pB77bU/_old 2022-01-31 22:57:15.797605257 +0100
+++ /var/tmp/diff_new_pack.pB77bU/_new 2022-01-31 22:57:15.801605230 +0100
@@ -20,7 +20,7 @@
%define import_path pkg.deepin.io/lib
Name: golang-github-linuxdeepin-go-lib
-Version: 5.7.10
+Version: 5.7.35
Release: 0
Summary: Go bindings for Deepin Desktop Environment development
License: GPL-3.0-or-later
@@ -39,7 +39,7 @@
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(x11)
-%if 0%{?suse_version} > 1500
+%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150300
BuildRequires: golang(API) = 1.15
%endif
BuildArch: noarch
++++++ go-lib-5.7.10.tar.gz -> go-lib-5.7.35.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/dbusutil/proxy/object_mock.go
new/go-lib-5.7.35/dbusutil/proxy/object_mock.go
--- old/go-lib-5.7.10/dbusutil/proxy/object_mock.go 1970-01-01
01:00:00.000000000 +0100
+++ new/go-lib-5.7.35/dbusutil/proxy/object_mock.go 2021-09-09
03:49:55.000000000 +0200
@@ -0,0 +1,55 @@
+package proxy
+
+import (
+ "fmt"
+
+ "github.com/godbus/dbus"
+ "github.com/stretchr/testify/mock"
+ "pkg.deepin.io/lib/dbusutil"
+)
+
+type MockObject struct {
+ mock.Mock
+}
+
+func (o *MockObject) Path_() dbus.ObjectPath {
+ mockArgs := o.Called()
+
+ ret, ok := mockArgs.Get(0).(dbus.ObjectPath)
+ if !ok {
+ panic(fmt.Sprintf("assert: arguments: 0 failed because object
wasn't correct type: %v", mockArgs.Get(0)))
+ }
+
+ return ret
+}
+
+func (o *MockObject) ServiceName_() string {
+ mockArgs := o.Called()
+
+ return mockArgs.String(0)
+}
+
+func (o *MockObject) InitSignalExt(sigLoop *dbusutil.SignalLoop, ruleAuto
bool) {
+ o.Called(sigLoop, ruleAuto)
+}
+
+func (o *MockObject) RemoveAllHandlers() {
+ o.Called()
+}
+
+func (o *MockObject) RemoveHandler(handlerId dbusutil.SignalHandlerId) {
+ o.Called(handlerId)
+}
+
+func (o *MockObject) ConnectPropertiesChanged(
+ cb func(interfaceName string, changedProperties map[string]dbus.Variant,
+ invalidatedProperties []string)) (dbusutil.SignalHandlerId,
error) {
+ mockArgs := o.Called(cb)
+
+ ret0, ok := mockArgs.Get(0).(dbusutil.SignalHandlerId)
+ if !ok {
+ panic(fmt.Sprintf("assert: arguments: 0 failed because object
wasn't correct type: %v", mockArgs.Get(0)))
+ }
+
+ return ret0, mockArgs.Error(1)
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/gen_test_report.sh
new/go-lib-5.7.35/gen_test_report.sh
--- old/go-lib-5.7.10/gen_test_report.sh 2021-06-01 04:22:55.000000000
+0200
+++ new/go-lib-5.7.35/gen_test_report.sh 2021-09-09 03:49:55.000000000
+0200
@@ -4,15 +4,30 @@
#gThirdpartPath="vendor"
gThirdpartPath="gopath"
#gThirdpartPath="gobuild"
-# ??????????????????????????????????????????????????????
+# ??????????????????????????????????????????????????????????????????
gIgnorePaths=("gobuild" "gopath" "vendor")
-gHTMLFile=./cover_report/index.html
+
+# ???????????????????????????
+gReportDir=./cover_report
+gHTMLFile=${gReportDir}/index.html
+gDeleteCoverageData=1 # 1 -
????????????????????????????????????????????????, 0 - ?????????
+
+
+####################################################################################
+
+if [ $# == 1 ] && [ "$1" == "clean" ]; then
+ rm ${gReportDir} -rf
+ echo "clean"
+ exit
+fi
gFuncHit=0
gFuncTotal=0
gRowHit=0
gRowTotal=0
+gTestCaseNumTotal=0
+gTestCaseNumFailed=0
function getGOPath() {
echo "$(pwd):$(pwd)/${gThirdpartPath}:${GOPATH}"
@@ -36,6 +51,7 @@
echo ${ret//"_"$currentDirectory/.}
}
+# ?????????????????????????????????????????????????????????????????????
function getGoDirect() {
arrDirGo=()
@@ -69,7 +85,152 @@
done
}
+# ???????????????????????????
+function TestCasesNum() {
+ # ??????gotest
+ gTestCaseNumTotal=$(grep -c '^=== RUN[^\/]*$' ${gReportDir}/test.log)
+ gTestCaseNumFailed=$(grep -c '^--- FAIL[^\/]*$' ${gReportDir}/test.log)
+
+ # ?????????????????????
+ TestCasesNumByGoCheck
+ TestCasesNumByGoConvey
+
+ if [ ${gDeleteCoverageData} == 1 ]; then
+ rm ${gReportDir}/test.log -f
+ fi
+}
+
+# ??????????????????????????? - ????????????gocheck(gopkg.in/check)
+function TestCasesNumByGoCheck() {
+ while read -r line
+ do
+ # OK: 5 passed, 2 skipped
+ # OOPS: 3 passed, 1 FAILED
+ #
skipped???????????????????????????????????????????????????????????????OOPS
+ if [ "$line" == "" ]; then
+ continue
+ fi
+ success=$(echo $line | grep -Eo ' [^ ]* passed' | tr -cd "(0-9)")
+ if [ "$success" != "" ]; then
+ gTestCaseNumTotal=$((gTestCaseNumTotal+success))
+ fi
+ failed=$(echo $line | grep -Eo ' [^ ]* FAILED' | tr -cd "(0-9)")
+ if [ "$failed" != "" ]; then
+ gTestCaseNumTotal=$((gTestCaseNumTotal+failed))
+ gTestCaseNumFailed=$((gTestCaseNumFailed+failed))
+ #
????????????Suite??????????????????testing.T???????????????????????????????????????????????????1
+ ((gTestCaseNumFailed--))
+ fi
+ #
????????????????????????????????????Suite?????????Suite????????????testing.T?????????testing.T????????????????????????????????????????????????1
+ ((gTestCaseNumTotal--))
+ done <<< $(grep '^O[KO][P:][S ].*' ${gReportDir}/test.log)
+}
+
+# ??????????????????????????? -
????????????goconvey(github.com/smartystreets/goconvey)
+function TestCasesNumByGoConvey() {
+ isInTest=0 # ???????????????????????????????????????gotest???testing.T
+ failedNum=0
+ isConvey=0 # ???????????????testing.T??????goconvey
+ isConveyFailed=0 # ????????????goconvey????????????????????????
+ echo "" >> ${gReportDir}/test.log
+ while read -r line
+ do
+ # === RUN TestReader
+ # Test Reader ??????
+ # Get Pid ????????????
+ # ReadAll ??????
+ # 8 total assertions
+ # Test ReadAll error ???
+ # Failures:
+ # * /home/feng08/code/go/src/go-lib/encoding/kv/reader_test.go
+ # 9 total assertions
+ # Test Read shell vars ????????????????????????
+ # 17 total assertions
+ # --- FAIL: TestReader (0.00s)
+ if [ "$line" == "" ]; then
+ continue
+ fi
+ startHit=$(echo $line | grep -c '^=== RUN[^\/]*$')
+ if [ $startHit == 1 ]; then
+ isInTest=1
+ continue
+ fi
+ endHit=$(echo $line | grep -c '^--- [^\/]*$')
+ if [ $endHit == 1 ]; then
+ isInTest=0
+ if [ $isConvey == 1 ]; then
+ # testing.T????????????????????????????????????????????????
+ ((gTestCaseNumTotal--))
+ isConvey=0
+ fi
+ if [ $isConveyFailed == 1 ]; then
+ # testing.T???????????????????????????????????????
+ ((gTestCaseNumFailed--))
+ isConveyFailed=0
+ fi
+ continue
+ fi
+ if [ $isInTest == 0 ]; then
+ continue
+ fi
+ failedHit=$(echo $line | grep -c '???')
+ if [ $failedHit == 1 ]; then
+ ((failedNum++))
+ continue
+ fi
+ conveyHit=$(echo $line | grep -c '^[0-9]* total assertions$')
+ if [ $conveyHit == 1 ]; then
+ # ????????????????????????goconvey??????
+ isConvey=1
+ ((gTestCaseNumTotal++))
+ if [ $failedNum != 0 ]; then
+ isConveyFailed=1
+ ((gTestCaseNumFailed++))
+ fi
+ failedNum=0
+ continue
+ fi
+ done < ${gReportDir}/test.log
+}
+
+# ???????????????????????????
+function TestCasesNumByTestFile() {
+ gTestCaseNumTotal=0
+ while read -r file
+ do
+ GoConveyNum=0
+ GoCheckNum=0
+ GoTestNum=0
+ while read -r line
+ do
+ # ??????????????????????????????
+ trimLine=$(awk '{sub(/^[\t ]*/,"");print}' <<< $line)
+ if [ "${trimLine:0:2}" == "//" ] || [ "${trimLine:0:2}" == "/*" ];
then
+ # ???????????????
+ continue
+ fi
+ GoConveyHit=$(echo $line | grep -c '^Convey(.*func(.*$')
+ GoConveyNum=$((GoConveyNum+GoConveyHit))
+ GoCheckHit=$(echo $line | grep -c '^func (.*\*C\.C).*$')
+ GoCheckNum=$((GoCheckNum+GoCheckHit))
+ GoTestHit=$(echo $line | grep -c '^func .*\*testing\.T.*$')
+ GoTestNum=$((GoTestNum+GoTestHit))
+ done < $file
+ if [ $GoConveyNum != 0 ] || [ $GoCheckNum != 0 ]; then
+ #
???gocheck??????goconvey???????????????gotest??????????????????????????????????????????
+ GoTestNum=0
+ fi
+
gTestCaseNumTotal=$((gTestCaseNumTotal+GoCheckNum+GoConveyNum+GoTestNum))
+ done <<< $(find ./ -type f -name "*_test.goo")
+
+ echo $gTestCaseNumTotal
+ echo $gTestCaseNumFailed
+}
+
+# ??????????????????
function makeTest() {
+ mkdir -pv $gReportDir
+
arrSupplementDir=()
while read -r line
do
@@ -82,16 +243,19 @@
do
supplementFile=${supplementDir}"/auto_generate_temp_go_test.go"
name=$(grep "^package .*" "${supplementDir}"/*.go | head -n 1 | cut -d
":" -f 2)
- echo "supplement:""${supplementDir}"" - ""${name}"
+ # echo "supplement:""${supplementDir}"" - ""${name}"
echo "${name}" >> "$supplementFile"
done
#exit
echo "gotest dir:$(getTestPath)"
- env GOPATH="$(getGOPath)" go test $(getTestPath) -cover
-coverprofile=coverage.data
- env GOPATH="$(getGOPath)" go tool cover -func=coverage.data -o coverage.txt
- # ???????????????????????????????????????????????????html??????
- #env GOPATH=$(getGOPath) go tool cover -html=coverage.data -o coverage.html
+ env GOPATH="$(getGOPath)" go test $(getTestPath) -v -cover
-coverprofile=${gReportDir}/coverage.data | tee ${gReportDir}/test.log
+ env GOPATH="$(getGOPath)" go tool cover -func=${gReportDir}/coverage.data
-o ${gReportDir}/coverage.txt
+
+ if [ ${gDeleteCoverageData} == 0 ]; then
+ # ???????????????????????????????????????????????????html??????
+ env GOPATH=$(getGOPath) go tool cover
-html=${gReportDir}/coverage.data -o ${gReportDir}/coverage.html
+ fi
find ./ -type f -name "auto_generate_temp_go_test.go" -exec rm -rf {} \;
@@ -106,8 +270,10 @@
if [ "${arrData[1]}" != "0" ] && [ "${arrData[2]}" != "0" ]; then
gRowHit=$((gRowHit+arrData[1]))
fi
- done < coverage.data
- rm coverage.data -f
+ done < ${gReportDir}/coverage.data
+ if [ ${gDeleteCoverageData} == 1 ]; then
+ rm ${gReportDir}/coverage.data -f
+ fi
while read -r line
do
@@ -115,15 +281,16 @@
((gFuncHit++))
fi
((gFuncTotal++))
- done < coverage.txt
+ done < ${gReportDir}/coverage.txt
# ????????????????????????
((gFuncHit--))
((gFuncTotal--))
+
+ TestCasesNum
}
+# ??????html????????????
function genHtml() {
-
- mkdir -pv ./cover_report
echo "generate html report."
curdir=$(pwd)
dirName=${curdir##*/}
@@ -135,6 +302,17 @@
echo "<body><h2>$dirName code coverage report - gotest[$datetime]</h2>" >>
$gHTMLFile
echo "<hr/>" >> $gHTMLFile
+ testCaseNumSuccess=$((gTestCaseNumTotal-gTestCaseNumFailed))
+ testCaseFailedCoverage=0
+ if [ $gTestCaseNumTotal -ne 0 ];then
+ testCaseFailedCoverage=$(awk -v v1=$gTestCaseNumFailed -v
v2=$gTestCaseNumTotal 'BEGIN{printf "%.2f",v1*100/v2}')
+ fi
+ echo "<p style=\"font-size:18px\">??????????????????:</p>" >> $gHTMLFile
+ echo "<table border=\"1\" bordercolor=\"#000000\" width=\"1000\"
style=\"BORDER-COLLAPSE: collapse\" >" >> $gHTMLFile
+ echo "<tr style=\"color:White\"
bgColor=#0066CC><th>??????????????????</th><th>???????????????</th><th>???????????????</th><th>?????????</th></tr>"
>> $gHTMLFile
+ echo "<tr align=\"center\"
><td>${gTestCaseNumTotal}</td><td>${gTestCaseNumFailed}</td><td>${testCaseNumSuccess}</td><td>$testCaseFailedCoverage%</td></tr>"
>> $gHTMLFile
+ echo "</table>" >> $gHTMLFile
+
rowCoverage=0
if [ $gRowTotal -ne 0 ];then
rowCoverage=$(awk -v v1=$gRowHit -v v2=$gRowTotal 'BEGIN{printf
"%.2f",v1*100/v2}')
@@ -143,15 +321,14 @@
if [ $gFuncTotal -ne 0 ];then
funcCoverage=$(awk -v v1=$gFuncHit -v v2=$gFuncTotal 'BEGIN{printf
"%.2f",v1*100/v2}')
fi
-
- echo "<p>total:</p>" >> $gHTMLFile
+ echo "<p style=\"font-size:18px\">???????????????:</p>" >> $gHTMLFile
echo "<table border=\"1\" bordercolor=\"#000000\" width=\"1000\"
style=\"BORDER-COLLAPSE: collapse\" >" >> $gHTMLFile
echo "<tr style=\"color:White\"
bgColor=#0066CC><th></th><th>Hit</th><th>Total</th><th>Coverage</th></tr>" >>
$gHTMLFile
echo "<tr align=\"center\"
><td>Lines</td><td>$gRowHit</td><td>$gRowTotal</td><td>$rowCoverage%</td></tr>"
>> $gHTMLFile
echo "<tr align=\"center\"
><td>Functions</td><td>$gFuncHit</td><td>$gFuncTotal</td><td>$funcCoverage%</td></tr>"
>> $gHTMLFile
echo "</table>" >> $gHTMLFile
- echo "<p>per function:</p>" >> $gHTMLFile
+ echo "<p style=\"font-size:18px\">????????????????????????:</p>" >>
$gHTMLFile
echo "<table border=\"1\" bordercolor=\"#000000\" width=\"1000\"
style=\"BORDER-COLLAPSE: collapse\" >" >> $gHTMLFile
echo "<tr style=\"color:White\"
bgColor=#0066CC><th>go??????</th><th>??????</th><th>?????????</th></tr>" >>
$gHTMLFile
while read line || [[ -n ${line} ]]
@@ -160,11 +337,17 @@
if [ "${arrLine[0]}" == "total:" ];then
continue
fi
- echo "<tr align=\"center\"
><td>$dirName${arrLine[0]#*$dirName}</td><td>${arrLine[1]}</td><td>${arrLine[2]}</td></tr>"
>> $gHTMLFile
- done < coverage.txt
+ filePath=${arrLine[0]#*$dirName}
+ if [ "${filePath:0:1}" != "/" ]; then
+ filePath="/$filePath"
+ fi
+ echo "<tr align=\"center\"
><td>$dirName$filePath</td><td>${arrLine[1]}</td><td>${arrLine[2]}</td></tr>"
>> $gHTMLFile
+ done < ${gReportDir}/coverage.txt
echo "</table></body></html>" >> $gHTMLFile
- rm coverage.txt
+ if [ ${gDeleteCoverageData} == 1 ]; then
+ rm ${gReportDir}/coverage.txt -f
+ fi
}
makeTest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/gettext/gettext.go
new/go-lib-5.7.35/gettext/gettext.go
--- old/go-lib-5.7.10/gettext/gettext.go 2021-06-01 04:22:55.000000000
+0200
+++ new/go-lib-5.7.35/gettext/gettext.go 2021-09-09 03:49:55.000000000
+0200
@@ -97,6 +97,14 @@
return C.GoString(C.bindtextdomain(_domain, _dirname))
}
+func BindTextdomainCodeset(domain, codeset string) string {
+ _domain := C.CString(domain)
+ _codeset := C.CString(codeset)
+ defer C.free(unsafe.Pointer(_domain))
+ defer C.free(unsafe.Pointer(_codeset))
+ return C.GoString(C.bind_textdomain_codeset(_domain, _codeset))
+}
+
func NTr(msgid, plural string, n int) string {
cMsgid := C.CString(msgid)
defer C.free(unsafe.Pointer(cMsgid))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/mime/mime.go
new/go-lib-5.7.35/mime/mime.go
--- old/go-lib-5.7.10/mime/mime.go 2021-06-01 04:22:55.000000000 +0200
+++ new/go-lib-5.7.35/mime/mime.go 2021-09-09 03:49:55.000000000 +0200
@@ -21,7 +21,10 @@
import (
"fmt"
- "pkg.deepin.io/gir/gio-2.0"
+ "os"
+ "path/filepath"
+
+ gio "pkg.deepin.io/gir/gio-2.0"
dutils "pkg.deepin.io/lib/utils"
)
@@ -29,6 +32,8 @@
MimeTypeGtk = "application/x-gtk-theme"
MimeTypeIcon = "application/x-icon-theme"
MimeTypeCursor = "application/x-cursor-theme"
+
+ MimeUserConfig = ".config/mimeapps.list"
)
// Query query file mime type
@@ -48,7 +53,8 @@
//
// desktopId: the basename of the desktop file
func SetDefaultApp(mime, desktopId string) error {
- cur, _ := GetDefaultApp(mime, false)
+ // If the default app is in /usr/share/applications/, still go to set
+ cur := GetUserDefaultApp(mime)
if cur == desktopId {
return nil
}
@@ -63,8 +69,24 @@
return err
}
+// get default from ~/.config/mimeapps.list
+func GetUserDefaultApp(ty string) string {
+ v, exist := dutils.ReadKeyFromKeyFile(filepath.Join(os.Getenv("HOME"),
MimeUserConfig),
+ "Default Applications", ty, "")
+ if !exist {
+ return ""
+ }
+
+ ret, ok := v.(string)
+ if !ok {
+ return ""
+ }
+
+ return ret
+}
+
// Get default app for 'mime'
-//
+// gio.AppInfoGetDefaultForType can get default from ~/.config/mimeapps.list
??? /usr/share/applications/mimeinfo.cache ,
/usr/share/applications/mimeapps.list
// ret0: desktopId
func GetDefaultApp(mime string, mustSupportURIs bool) (string, error) {
app := gio.AppInfoGetDefaultForType(mime, false)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/pinyin/pinyin_test.go
new/go-lib-5.7.35/pinyin/pinyin_test.go
--- old/go-lib-5.7.10/pinyin/pinyin_test.go 1970-01-01 01:00:00.000000000
+0100
+++ new/go-lib-5.7.35/pinyin/pinyin_test.go 2021-09-09 03:49:55.000000000
+0200
@@ -0,0 +1,17 @@
+package pinyin
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+func Test_HansToPinyin(t *testing.T) {
+ pinyinMap := make(map[int]string)
+ array := HansToPinyin("????????????")
+ for i, a := range array {
+ pinyinMap[i] = a
+ }
+ assert.Len(t, pinyinMap, 2)
+ assert.Equal(t, pinyinMap[0], "tongxinruanjian")
+ assert.Equal(t, pinyinMap[1], "tongshenruanjian")
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/sound/utils_test.go
new/go-lib-5.7.35/sound/utils_test.go
--- old/go-lib-5.7.10/sound/utils_test.go 1970-01-01 01:00:00.000000000
+0100
+++ new/go-lib-5.7.35/sound/utils_test.go 2021-09-09 03:49:55.000000000
+0200
@@ -0,0 +1,16 @@
+package sound
+
+import (
+ "fmt"
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+func Test_findThemeFile(t *testing.T) {
+ file, err := findThemeFile("freedesktop", "service-login")
+ if err != nil {
+ assert.Equal(t, err, fmt.Errorf("invalid theme event"))
+ } else {
+ assert.Equal(t, file,
"/usr/share/sounds/freedesktop/stereo/service-login.oga")
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/go-lib-5.7.10/utils/file.go
new/go-lib-5.7.35/utils/file.go
--- old/go-lib-5.7.10/utils/file.go 2021-06-01 04:22:55.000000000 +0200
+++ new/go-lib-5.7.35/utils/file.go 2021-09-09 03:49:55.000000000 +0200
@@ -177,6 +177,19 @@
return files, nil
}
+// ??????????????????
+func SyncWriteFile(filename string, data []byte, perm os.FileMode) error {
+ f, err := os.OpenFile(filename,
os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_TRUNC, perm)
+ if err != nil {
+ return err
+ }
+ _, err = f.Write(data)
+ if err1 := f.Close(); err == nil {
+ err = err1
+ }
+ return err
+}
+
func iterCopyDir(src, dest string, mode os.FileMode) error {
sr, err := os.Open(src)
if err != nil {