403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/share/go/src/cmd/go/testdata/script/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/go/src/cmd/go/testdata/script/mod_tidy_diff.txt
# Test go mod tidy -diff
# If set, -diff should not update go.mod or go.sum and instead return a non-zero exit code if updates are needed.

# Missing go.mod and go.sum should fail and not display diff.
! exists go.mod
! exists go.sum
! go mod tidy -diff
! exists go.mod
! exists go.sum
! stdout 'diff current/go.mod tidy/go.mod'
! stdout 'diff current/go.sum tidy/go.sum'
stderr 'go.mod file not found'

# Missing go.mod and existing go.sum should fail and not display diff.
cp go.sum.orig go.sum
! exists go.mod
exists go.sum
! go mod tidy -diff
! exists go.mod
! stdout 'diff current/go.mod tidy/go.mod'
! stdout 'diff current/go.sum tidy/go.sum'
stderr 'go.mod file not found'

# Existing go.mod and missing go.sum should display diff.
go mod init example.com
go mod tidy
rm go.sum
exists go.mod
! exists go.sum
! go mod tidy -diff
! exists go.sum
! stdout 'diff current/go.mod tidy/go.mod'
stdout 'diff current/go.sum tidy/go.sum'

# Everything is tidy, should return zero exit code.
go mod tidy
go mod tidy -diff
! stdout 'diff current/go.mod tidy/go.mod'
! stdout 'diff current/go.sum tidy/go.sum'

# go.mod requires updates, should return non-zero exit code.
cp go.mod.orig go.mod
! go mod tidy -diff
stdout 'diff current/go.mod tidy/go.mod'
! stdout 'diff current/go.sum tidy/go.sum'
cmp go.mod.orig go.mod

# go.sum requires updates, should return non-zero exit code.
go mod tidy
cp go.sum.orig go.sum
! go mod tidy -diff
! stdout 'diff current/go.mod tidy/go.mod'
stdout 'diff current/go.sum tidy/go.sum'
cmp go.sum.orig go.sum

# go.mod and go.sum require updates, should return non-zero exit code.
cp go.mod.orig go.mod
cp go.sum.orig go.sum
! go mod tidy -diff
stdout 'diff current/go.mod tidy/go.mod'
stdout 'diff current/go.sum tidy/go.sum'
cmp go.mod.orig go.mod
cmp go.sum.orig go.sum

# Save the result from running tidy.
[exec:patch] cp go.mod.orig go.mod
[exec:patch] cp go.sum.orig go.sum
[exec:patch] go mod tidy
[exec:patch] cp go.mod go.mod.tidyResult
[exec:patch] cp go.sum go.sum.tidyResult

# Compare output of -diff to running tidy.
# Apply the patch from -diff
[exec:patch] cp go.mod.orig go.mod
[exec:patch] cp go.sum.orig go.sum
[exec:patch] ! go mod tidy -diff
[exec:patch] cp stdout diff.patch
[exec:patch] exec patch -p1 -i diff.patch
[exec:patch] go mod tidy -diff
[exec:patch] ! stdout .
[exec:patch] cmp go.mod go.mod.tidyResult
[exec:patch] cmp go.sum go.sum.tidyResult


-- main.go --
package main

import "rsc.io/quote"

func main() {
	println(quote.Hello())
}

-- go.mod.orig --
module example.com

go 1.22
-- go.sum.orig --
rsc.io/quote v1.5.2 h1:3fEykkD9k7lYzXqCYrwGAf7iNhbk4yCjHmKBN9td4L0=

Youez - 2016 - github.com/yon3zu
LinuXploit