Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go lang for bug #67742

Closed
pythonliuwei-root opened this issue May 31, 2024 · 6 comments
Closed

go lang for bug #67742

pythonliuwei-root opened this issue May 31, 2024 · 6 comments

Comments

@pythonliuwei-root
Copy link

Go version

go1.22.2 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/lw/Library/Caches/go-build'
GOENV='/Users/lw/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/lw/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/lw/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/65/4lr1b23976g45nk0pyrdgl_m0000gn/T/go-build3219076892=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

// my computer is mac mini m2 128G software is vscode
package main

import "fmt"

func main() {

for i := 1; 1 <= 100; i++ {
	if i%6 == 0 {
		fmt.Println(i)
	}
}

}

What did you see happen?

2491068
2491074
2491080
2491086
2491092
2491098
2491104
2491110
2491116
2491122
2491128
2491134
2491140
2491146
2491152
2491158
2491164
2491170
2491176
2491182
2491188
2491194
2491200
2491206
2491212
2491218
2491224
2491230
2491236
2491242
2491248
2491254
2491260
2491266
2491272
2491278
2491284
2491290
2491296
2491302
2491308
2491314
2491320
2491326
2491332
2491338
2491344
2491350
2491356
2491362
2491368
2491374
2491380
2491386
2491392
2491398
2491404
2491410
2491416
2491422
2491428
2491434
2491440
2491446
2491452
2491458
2491464
2491470
2491476
2491482
2491488
2491494
2491500
2491506
2491512
2491518
2491524
2491530
2491536
2491542
2491548
2491554
2491560
2491566
2491572
2491578
2491584
2491590
2491596
2491602
2491608
2491614
2491620
2491626
2491632
2491638
2491644
2491650
2491656
2491662
2491668
2491674
2491680
2491686
2491692
2491698
2491704
2491710
2491716
2491722
2491728
2491734
2491740
2491746
2491752
2491758
2491764
2491770
2491776
2491782
2491788
2491794
2491800
2491806
2491812
2491818
2491824
2491830
2491836
2491842
2491848
2491854
2491860
2491866
2491872
2491878
2491884
2491890
2491896
2491902
2491908
2491914
2491920
2491926
2491932
2491938
2491944
2491950
2491956
2491962
2491968
2491974
2491980
2491986
2491992
2491998
2492004
2492010
2492016
2492022
2492028
2492034
2492040
2492046
2492052
2492058
2492064
2492070
2492076
2492082
2492088
2492094
2492100
2492106
2492112
2492118
2492124
2492130

What did you expect to see?

6
12
18
24
30
36
42
...

@pythonliuwei-root
Copy link
Author

package main

import "fmt"

func main() {
for i := 1; 1 <= 100; i++ {
if i % 6 == 0 {
fmt.Println(i)
}
}

}

@seankhliao
Copy link
Member

seankhliao commented May 31, 2024

how are you running the code?
it looks more likely to be a problem with your IDE rather than Go.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
@pythonliuwei-root
Copy link
Author

for.bug.mp4

5fab0771ac04f3e69acce204365d64ac
e9f07648b9ae992b205646af19b27708

@pythonliuwei-root
Copy link
Author

for_bug.mp4

@seankhliao
Copy link
Member

1 <= 100 is always true

@pythonliuwei-root
Copy link
Author

oh! I get haha.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants