text:
feat(select): migrate from decorators to signals

PR Checklist
Please check if your PR fulfills the following requirements:

[x] The commit message follows our
guidelines: https://github.com/goetzrobin/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines
[x] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)

PR Type
What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

Which package are you modifying?

[ ] accordion
[ ] alert
[ ] alert-dialog
[ ] aspect-ratio
[ ] avatar
[ ] badge
[ ] button
[ ] calendar
[ ] card
[ ] checkbox
[ ] collapsible
[ ] combobox
[ ] command
[ ] context-menu
[ ] data-table
[ ] date-picker
[ ] dialog
[ ] dropdown-menu
[ ] hover-card
[ ] icon
[ ] input
[ ] label
[ ] menubar
[ ] navigation-menu
[ ] pagination
[ ] popover
[ ] progress
[ ] radio-group
[ ] scroll-area
[x] select
[ ] separator
[ ] sheet
[ ] skeleton
[ ] slider
[ ] sonner
[ ] spinner
[ ] switch
[ ] table
[ ] tabs
[ ] textarea
[ ] toast
[ ] toggle
[ ] tooltip
[ ] typography

What is the current behavior?
All inputs/outputs/viewchild/contentchild etc are all decorator based currently
What is the new behavior?
Migrates all decorators to signal based primitives to prepare for zoneless and match rest of collection of components
Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This is important

Will need to rebase this and finalize the implementation a little later especially with #354 probably getting merged here

repo: goetzrobin/spartan


text:
Update outdated bootstrap/jquery scripts

Title
Update outdated bootstrap/jquery scripts
Summary
Update bootstrap/jquery scripts used within the forbidden template
Why?
The scripts are out of date, and have some vulnerabilities
https://security.snyk.io/package/npm/jquery
https://security.snyk.io/package/npm/bootstrap
How
The forbidden template references these scripts -> https://github.com/gogatekeeper/gatekeeper/blob/master/templates/forbidden.html.tmpl
Acceptance criteria
Jquery updated to non vulnerable versions (3.7.1 current latest)
Bootstrap updated to non vulnerable versions (5.3 current latest)

@georgeeker thanks for creating issue! will update

@georgeeker updated

source: gharchive/issue

repo: gogatekeeper/gatekeeper

license_type: permissive

license_source: github-api


text:
Github authentication causes redirect loop on self hosted drone

Hey!
I'm running drone 0.4 in docker behind nginx reverse proxy (nginx handles https).
My configs:
"REMOTE_CONFIG=https://github.com?client_id=$ID&client_secret=$SECRET",
"REMOTE_DRIVER=github",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DATABASE_DRIVER=sqlite3",
"DATABASE_CONFIG=/var/lib/drone/drone.sqlite"

Github redirects me into url:
https://REDACTED/authorize?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fv3%2Foauth%2F%23redirect-uri-mismatch&state=AVE5YPXBHDUGHYTRJHXFPA2Z3JFSISUA553ZYYFU7Q6XVX7QY2LQ%3D%3D%3D%3D

Which redirects back to:
https://github.com/login/oauth/authorize?client_id={REDACTED}&redirect_uri=http%3A%2F%2F{REDACTED}%2Fauthorize&response_type=code&scope=repo%2Crepo%3Astatus%2Cuser%3Aemail&state=ERISZ56LRZ35B2UGK4D2YDDUSCQTAIQ5WS2BEFRP2NS4E4BIW2GQ%3D%3D%3D%3D

It seems that my application is wrongly configured.
Should drone handle the error parameters from Github, At least give user notification that the settings are wrong?
I'm using /authorize endpoint in Github application Authorization callback URL.

Whoops wrong project! Sorry!

:trollface:

authors: Unknwon onnimonni

repo: gogits/gogs

license: MIT


text:
PR Webhook - Add base/head info

Regarding https://github.com/gogits/gogs/issues/3484
Requires https://github.com/gogits/go-gogs-client/pull/47

Any update on this PR?

It would be fantastic to have this data. I'm trying to add Gogs support to codebeat and we're missing crucial pieces of info in the webhook payload:

source ref;
source repo;
base ref;
base repo;
last source commit hash;

GitHub, Bitbucket and Gitlab all provide these fields on one form or another so they're pretty much an industry standard and enable cool integrations.

@kmadel Would it be possible for you to open this PR also on https://github.com/go-gitea/gitea ?

@hhenkel sure, np

Thanks!

source: gharchive/pull-request

authors: Unknwon hhenkel kmadel lstahlman marcinwyszynski


text:
请问怎么设置缓存永不过期

是设置为0吗？

不建议设置永久不过期，设置大一点就行，过期后会重新缓存。

authors: JIeJaitt gogobody

repo: gogobody/TpCache


text:
FAILURE: Build failed with an exception.  * What went wrong: Execution failed for task ':resolveBuildDependencies'. > This value cannot be false!

你好，刚刚使用gogradle构建项目，但是出现这个情况，麻烦指点一下

F:\GOPATH\src\go-utils-lizhi>gradlew.bat vendor -s

Configure project :
Found go 1.9.2 in C:\Go\bin\go.exe, use it.

Task :prepare
Found global GOPATH: F:\GOPATH\src\go-utils-lizhi;F:\GOPATH.

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':resolveBuildDependencies'.

This value cannot be false!

Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':resolveBuildDependencies'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:59)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:128)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:314)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:204)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:134)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:109)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalStateException: This value cannot be false!
at com.github.blindpirate.gogradle.util.Assert.isTrue(Assert.java:30)
at com.github.blindpirate.gogradle.util.Assert.isTrue(Assert.java:25)
at com.github.blindpirate.gogradle.core.GolangPackage.resolve(GolangPackage.java:58)
at com.github.blindpirate.gogradle.core.GolangPackage.resolve(GolangPackage.java:69)
at com.github.blindpirate.gogradle.core.pack.DefaultPackagePathResolver.lambda$updateCache$0(DefaultPackagePathResolver.java:71)
at com.github.blindpirate.gogradle.core.pack.DefaultPackagePathResolver.updateCache(DefaultPackagePathResolver.java:71)
at com.github.blindpirate.gogradle.core.pack.DefaultPackagePathResolver.produce(DefaultPackagePathResolver.java:62)
at com.github.blindpirate.gogradle.core.dependency.DefaultDependencyRegistry.getAllVersions(DefaultDependencyRegistry.java:209)
at com.github.blindpirate.gogradle.core.dependency.DefaultDependencyRegistry.register(DefaultDependencyRegistry.java:45)
at com.github.blindpirate.gogradle.core.dependency.tree.DependencyTreeFactory.resolve(DependencyTreeFactory.java:85)
at com.github.blindpirate.gogradle.core.dependency.tree.DependencyTreeFactory.getTree(DependencyTreeFactory.java:44)
at com.github.blindpirate.gogradle.task.ResolveDependencies.resolveDependencies(ResolveDependencies.java:172)
at com.github.blindpirate.gogradle.task.ResolveDependencies.resolve(ResolveDependencies.java:153)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 103 more

看stacktrace似乎是依赖包的声明方式不对。最好有可以复现的项目，否则只看stacktrace很难找到问题。

authors: blindpirate duanlizhi

repo: gogradle/gogradle

license_source: bigquery


text:
Update, document, or remove internal Schema.org template

$ hugo version
Hugo Static Site Generator v0.73.0-428907CC/extended darwin/amd64 BuildDate: 2020-06-23T16:37:47Z

The current schema template does not define itemscope and itemtype, which are required for it to be valid. If you submit a page with the current meta tags to W3.org Validator you will see errors:
The itemprop attribute was specified, but the element is not a property of any item.
If you run the HTML through Google Structured Data Testing Tool no data will be parsed because it requires the above mentioned properties.
The wordCount meta entry in the template is only for the Article schema type, but if you set the type to Article in Google's tool, it will tell you it also requires "author", "headline", "publisher" which are not included in the template. The additional required fields that are included in the template, "datePublished" and "image", aren't required in the template.
In its current form, the template does not provide valid Schema.org structures. For users that are unfamiliar with Schema data structures it is adding HTML that won't validate and additional data that will not actually be parsed.
This template is mentioned, but not documented so users are not aware of the above issues. I feel documenting the template does little because the user still has to add several pieces of data to Params or frontmatter for anything meaningful to be added. The type of page is not as generic as OpenGraph (4 choices vs dozens in Schema)(ie "Article" is not always what I would consider "IsPage==True" to represent.)

On my site, I have some funky LD-JSON templates. Would that be a good replacement for the current internal metadata templates? Or do users need both?

I agree, see Understand how structured data works

Perhaps after #3088 is sorted a new schema internal template could be added. For example https://codingnconcepts.com/hugo/structure-data-json-ld-hugo/

@XhmikosR that issue doesn't seem to have made any significant progress in years. But thanks for that link to the structured data guide, that's very helpful!

Yeah, but the authors situation needs to be standardized first... Right now the internal templates are broken when it comes to authors.

Fair enough

I think this is still relevant.

I am starting to think pretty much all the internal templates should be replaced with blessed external modules.

authors: XhmikosR carlmjohnson inwardmovement mpctx rootwork

repo: gohugoio/hugo


text:
resources.Concat fails if resource file has numbers in it's name

Version: hugo v0.85.0+extended linux/amd64 BuildDate=unknown
Last release: Yes.
Code
{{ $pre := resources.Get "js/pre.js" }}
{{ $redirect := resources.Get "js/modules/i18n-redirect.js" }}
{{ $preBundle := slice $pre $redirect | resources.Concat "js/pre.js" }}

{{ if ne (hugo.Environment) "local" }}
  <!-- development -->
  {{ $preBundle = $preBundle | resources.Minify }}
{{ end -}}

<script src="{{ $preBundle.Permalink }}" async></script>

Error
at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
Solution
Renaming the file to a name without numbers. Eg redirect.js.

Cannot reproduce. works for me using number as a name.
hugo v0.86.0-DEV-8DDBC954+extended linux/amd64 BuildDate=2021-07-06T17:16:57+0700

The error message may be bad, but it has nothing to do with the filename.

Sorry. I reproduced it again but it isn't that the filename can't have numbers on it but that it was wrong (pointing to a file that didn't exist).

authors: bep danisztls pamubay


text:
fix/clock slow 9868

Use the system clock for build time
Add a site benchmark with the clock set

So, this makes the build time more sensible, but it's still very slow:
                   | EN  | ZH
-------------------+-----+------
  Pages            | 562 |  23
  Paginator pages  |   2 |   1
  Non-page files   |  92 |   1
  Static files     | 147 | 147
  Processed images | 474 |   0
  Aliases          |  16 |   4
  Sitemaps         |   2 |   1
  Cleaned          |   0 |   0

Total in 14870 ms


text:
Link the new ride page to dataset component.

Currently the bs-ride-recorder makes the call to server directly. It should go through the bs-dataset-rides instead.

closed in #34

license: mit


text:
supporting older versions in podfile

Supporting older version for pods in podfile + renaming Constraints to Configurations

@RishavG96 Please keep GRDB 5.12.0 version in separate branch so that others can use it, and GRDB 6.7.0 in main branch.

@RishavG96 Please keep GRDB 5.12.0 version in separate branch so that others can use it, and GRDB 6.7.0 in main branch.

Done

repo: gojek/clickstream-ios


text:
x/mobile/bind/java: translate panic to a java error

A panic() from Go code eventually results in a syscall to exit(2) which terminates the Android app. This "clean" exit prevents Crashlytics (https://get.fabric.io/crashlytics) from capturing a Go panic as a crash.
Crashlytics support told me:

We do install a signal handler to capture the crashes. You could write a custom panic() function in Go that uses the OS package to raise a signal, but we are hestitant to treat an exit() as a crash in the native code as it would be the program telling the OS that everything is fine.

Could we recover these panics and throw a Java Error? Or perhaps syscall abort (which should be caught by a SIGABRT handler) instead of exit?

where is the panic from?
If it occurs during executing the go function called from java, it's an option to make your go function recover, convert it to an error, and return an error which will be translated into a java exception.

The scenario I was testing was a Go function called from Java. Would be nice not to have to wrap all my external functions with panic/recover and have the runtime just support this, but maybe I'm asking too much.
To be a bit clearer, I'm not expecting any of my Go code to panic. But if I'm accessing an array out of bounds and the app is crashing for half my users, I want to have reporting that tells me that.

one option David Crawshaw suggested is to make gobind generate a code that recover and translate the panic to java exception.
cc @crawshaw

A Go panic has a lot of technical similarities to Java exceptions, but several conventional differences. Java exceptions are part of normal programming, Go panics are not.
We may be able to match the conventions by throwing a java.lang.Error. While throwable, it's not a subclass of java.lang.Exception, so the usual try { } catch (Exception e) {} boilerplate won't get catch it.
(It is more than a little confusing that Java Errors are like Go panics, and Java Exceptions are like Go errors.)
The only concern left is any potential performance impact from the defer/recover block, but I believe the language barrier will always incur a more significant overhead.

I took a stab at implementing this: https://go-review.googlesource.com/#/c/11920/
Feedback welcome. Haven't written C in years, and JNI code in... ever. :)

What was wrong with the suggestion of replacing exit(2) with abort(3)? Not every Go call originates from java, and it seems more appropriate for a library (libgojni.so) to abort rather than exit the foreign main program.

after chatting with @alandonovan the other day, I also realized that turning the panic into a java error addresses only part of the problem. There could be background goroutine causing crash, some library underneath deciding to crash, gc panics, or deadlock(not sure if it applies to library). In order to capture these cases, I also wish we could use abort instead of exit. @crawshaw @ianlancetaylor

That makes sense to me. Any benefit in translating to Error where we can (i.e. in Go code directly invoked from Java) and aborting when we can't? Maybe cleaner stack traces on the Errors?

@rsc pointed out runtime has already a way to change the program crash behavior by setting GOTRACEBACK env var and we may be able to utilize the similar hook.
http://golang.org/pkg/runtime/
"If GOTRACEBACK=crash, the per-goroutine stack traces include run-time functions, and if possible the program crashes in an operating-specific manner instead of exiting. For example, on Unix systems, the program raises SIGABRT to trigger a core dump."
On linux, the SIGABRT is handled and creates a core dump. On mobile, change the full stack trace to the Errors?

CL 12032 is my proposal for fixing this issue. GOTRACEBACK is read too early in the runtime initialization to allow for gomobile to fiddle with GOTRACEBACK and in any case I believe the aborting behaviour should cover all cases where C owns the process. In any case, GOTRACEBACK=crash behaviour includes GOTRACEBACK=2 behaviour (print runtime functions in tracebacks) which is not what we want here.

authors: crawshaw eliasnaur hyangah jamesshoebox

repo: golang/go


text:
os: TestLongPath failing on Plan 9

CL 32451 added TestLongPath. However this test is failing on Plan 9.
--- FAIL: TestLongPath (1.13s)
	os_test.go:1750: Size("/tmp/_Go_TestLongPath893630335/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/dir3456789/bar.txt") is 0, len(ReadFile()) is 12, want 0
FAIL

See https://build.golang.org/log/6d7b8caa753adbea2d9c4520296ead1e88ab94d2

The problem is that after the call to Truncate(tmpdir+"/bar.txt", 0) in TestLongPath, the file is zero sized, but the content is still accessible.
% ls -l _Go_TestLongPath462655911/bar.txt
--rw------- M 12853 djc djc 0 Nov  8 22:06 _Go_TestLongPath462655911/bar.txt
% cat _Go_TestLongPath462655911/bar.txt
hello world
% echo a >>_Go_TestLongPath462655911/bar.txt
% cat _Go_TestLongPath462655911/bar.txt
a

If we replace the call of Truncate(tmpdir+"/bar.txt", 0) by OpenFile(tmpdir+"/bar.txt", O_TRUNC, 0), the test succeeds.
The problem seems to only happen on the Fossil file server and not on ramfs or cwfs.

That seems like a Plan9 bug, no? If truncate doesn't work, the test is correctly failing...

Yes, it seems to be an issue related to the Fossil file server. I'll investigate.

This issue is caused by the devmnt cache in the Plan 9 kernel.
The file content is cached when writing the file. When reading the file, the content is firstly read from the cache (12 bytes), then the remaining is read from the file server (offset=12 > length=0, so 0 bytes). So devmnt, returns the 12 bytes "hello world" from the cache. This is happening because the call to wstat, which sets the file length to zero, doesn't invalidate the cache.
The fix would probably be to invalidate the cache on wstat when setting the length to zero.
I can reproduce the issue with other file servers like ramfs by mounting with the cache enabled (-C).

I've finally fixed the issue in the Fossil server by incrementing Qid.vers on wstat, so the next read will be done on a new version of the file instead of the cached one.
Here is the change: fossil-wstat-qid


text:
spec: review/clarify uses of "slice of bytes"

This is a follow-up issue for #23536: Comb through documentation (spec, builtins) to verify the use of the term "slice of bytes". The spec appears to mean by this any type whose underlying type is []byte. But not all implementations agree.

I just ran into this issue. I think it's valuable to at least come to a shared agreement on what we think the right behavior is, so we can start aligning the implementations.
I think the spec cases relevant here are:

Conversions: string -> []byte, string -> []rune, []byte -> string, []rune -> string
copy([]byte, string)
append([]byte, string...)

My 2c is that this should type check allowed:
package p

type (
	String string
	Byte   byte
	Bytes  []Byte
	Rune   rune
	Runes  []Rune
)

var (
	_ = Bytes(String(""))
	_ = Runes(String(""))

	_ = String(Bytes(nil))
	_ = String(Runes(nil))

	_ = copy(Bytes(nil), String(""))
	_ = append(Bytes(nil), String("")...)
)

gccgo accepts this.
cmd/compile and go/types currently reject the copy call, claiming that Bytes's element type (Byte) is different from byte.
go/types currently additionally rejects the append call too.
(Also notably, cmd/compile's typechecker allows String(Bytes(nil)) and String(Runes(nil)), but then walk.go fails to generate the appropriate conversions when calling runtime.slicebytetostring and runtime.slicerunetostring, so compilation fails.)

/cc @griesemer @ianlancetaylor

@rsc, @ianlancetaylor, @robpike Do you have any opinions here?
We're inconsistent at the moment and different implementations (cmd/compile, gccgo, go/types) differ for operations where this matters.

Personally, if there's any ambiguity that needs to be specified, I'd prefer to be a permissive as possible, letting copies/appends/conversions work as expected if the underlying representation is the same.

I'm inclined to agree with @mdempsky 's comment https://github.com/golang/go/issues/23814#issuecomment-536082226 .   I don't see any particular reason to restrict operations on a "slice of bytes" to only the type []byte.

I just rediscovered this in #36965.
Is there sufficient consensus here that I can fix cmd/compile’s implementation to use a maximally liberal interpretation of “byte slices?
Other things to check on once the desired direction is clear: is the spec clear enough? Do go/types, package reflect, cmd/compile, and gccgo agree?

(The reason I’d like to fix cmd/compile now/soon is that I’m touching this code anyway for #36890.)

@josharian The reason for this issue is that not all implementations agree. @mdempsky 's comment explains how they disagree.
I think we should first get the spec to be crystal clear before making changes. It sounds like we're leaning towards making the interpretation more liberal, so this should not break future code, but enable more. This is not urgent, either.

Marking for Go 1.15.

It looks like the consensus here is that "slice of bytes" should be maximally liberal, which would mean any slice of elements whose underlying type is bytes.

@griesemer This issue has milestone 1.18; shall we move to 1.19 or backlog?

This is documentation that we might be able to address. Prefer to leaving open for now.

Moving to 1.19.

The above CL adjusts the spec to interpret slice of bytes/runes in the most liberal way (underlying type of the slices' element types must be byte/rune) for conversions. This matches the current implementation (and closely matches 1.17 - see the CL description).
The behavior for copy/append is (and always was) more strict; also, also no explicit conversion happens in those cases, so the more strict behavior can be justified.
Since this issue is about "slice of bytes/runes", terminology that is only used in the Conversions section of the spec, the CL addresses only that aspect.
If we want to change the behavior for append/copy, we probably need to file a mini-proposal.

Maybe, the reflect implementation should also be made consistent with this change: https://github.com/golang/go/issues/23536#issuecomment-1007877545

@go101 Filed #53523.

authors: bradfitz go101 griesemer ianlancetaylor josharian mdempsky


text:
ioutil.ReadAll error when reading from gzip Reader

What version of Go are you using (go version)?
go version go1.10.2 windows/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
What did you do?
This program panic:
package main
import (
"io/ioutil"
"bytes"
"compress/gzip"
)
func main() {
data := []byte("HelloWorld")
var b bytes.Buffer
w := gzip.NewWriter(&b)
defer w.Close()
w.Write(data)
w.Flush()

r, _ := gzip.NewReader(&b)
defer r.Close()
rawData, err := ioutil.ReadAll(r)
println(string(rawData))
if err != nil {
	panic(err.Error())
}

}
The rawData is OK, but ioutil.ReadAll return an error : "unexpected EOF"

Defer is executed at the end of the function call. w is not closed by the time you construct a reader. The reason you get unexpected EOF is the writer is not closed so the end of file marker is missing.

authors: davecheney ismlsmile


text:
x/vgo: vgo build *.go fails for module versions >=2

What version of Go are you using (go version)?
go version go1.10.1 darwin/amd64 vgo:2018-02-20.1
Latest vgo:
commit 0f3e556044ecbd8a0805d098e52a743a1d0e3566 (HEAD -> master, origin/master, origin/HEAD)
Author: Tim Cooper <tim.cooper@layeh.com>
Date:   Fri Jun 22 17:51:20 2018 -0300

    cmd/go/internal/modcmd: fix sorting

What did you do?
Please refer to https://github.com/mwf/goplay/tree/master/vgo/hello_world
I check a case when we've got a binary with major version v2.0.0 and there is no v2 subdirectory or branch, major version is listed in go.mod instead.
It should be OK for vgo if I'm not mistaken, because you didn't want to force all go users to use a single workflow with branches or subdirectories. So we assume master branch is our current stable version, tags correspond with major version set in module directive.
go.mod:
module github.com/mwf/goplay/vgo/hello_world/v2

main.go:
package main

import (
	"fmt"
)

const Version = "V2"

func main() {
	fmt.Println("Hello world!")
	fmt.Println("Version:", Version)
}

vgo run . or vgo build . work without errors.
What did you expect to see?
vgo run main.go should run without errors
What did you see instead?
$ vgo run main.go
build github.com/mwf/goplay/vgo/hello_world: cannot find module for path github.com/mwf/goplay/vgo/hello_world

@bcmills @myitcv
Sorry for bothering guys, but have you looked at this issue?
I think it's rather important, because we usually use a command like go build main.go. Would be pity if it breaks in case of v2+ modules after the go1.11 release.

@mwf is this still an issue? I don't see any problems as of 6cd5a417451d8ee907692eded07ef1b6b53825b1:
cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello
vgo mod -init -module example.com/hello/v2
cat <<EOD > main.go
package main

import (
        "fmt"
)

const Version = "V2"

func main() {
        fmt.Println("Hello world!")
        fmt.Println("Version:", Version)
}
EOD
vgo run main.go
vgo build
./v2

(note: the last step needing to be ./v2 is covered by https://github.com/golang/go/issues/24667)

@myitcv yeap, I checked it with the same version. And there is some crazy thing about it.
Compare this (failing):
cd `mktemp -d`
export GOPATH=$PWD
git clone https://github.com/mwf/goplay src/github.com/mwf/goplay
cd src/github.com/mwf/goplay/vgo/hello_world
vgo build main.go

Output: build github.com/mwf/goplay/vgo/hello_world: cannot find module for path github.com/mwf/goplay/vgo/hello_world
And this (OK):
cd `mktemp -d`
git clone https://github.com/mwf/goplay
vgo build main.go

It's weird, but it builds OK if outside of GOPATH and fails if inside.
And the problem is only with v2+ modules, v1 works well in both cases.

@mwf nicely tracked down. Here's a standalone repro:
cd `mktemp -d`
export GOPATH=$PWD
mkdir -p src/example.com/hello
cd src/example.com/hello
vgo mod -init -module example.com/hello/v2
cat <<EOD > main.go
package main

import (
        "fmt"
)

const Version = "V2"

func main() {
        fmt.Println("Hello world!")
        fmt.Println("Version:", Version)
}
EOD
vgo run main.go

gives
build example.com/hello: cannot find module for path example.com/hello

Reproduced, thanks for these great scripts @myitcv.

This script works for me now (updated to use go instead of vgo).
Please reopen if you can still reproduce the problem some other way.
cd `mktemp -d`
export GOPATH=$PWD
mkdir -p src/example.com/hello
cd src/example.com/hello
go mod init example.com/hello/v2
cat <<EOD > main.go
package main

import (
        "fmt"
)

const Version = "V2"

func main() {
        fmt.Println("Hello world!")
        fmt.Println("Version:", Version)
}
EOD
go run main.go

@rsc I think this issue remains.
The point I missed when I was when retesting a couple of days ago is that since this issue was opened we have introduced the concept of GO111MODULE.
A slight tweak to the above shows the issue remains:
export GO111MODULE=on
cd `mktemp -d`
export GOPATH=$PWD
mkdir -p src/example.com/hello
cd src/example.com/hello
go mod init example.com/hello/v2
cat <<EOD > main.go
package main

import (
        "fmt"
)

const Version = "V2"

func main() {
        fmt.Println("Hello world!")
        fmt.Println("Version:", Version)
}
EOD
go run main.go

gives
build example.com/hello: cannot find module for path example.com/hello

authors: mwf myitcv rsc


text:
cmd/cover: tool cover -html draws invisible file chooser

What version of Go are you using (go version)?
go version go1.10.3 darwin/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sblackstone/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sblackstone/code/furious/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vv/1cv4dp094z5bvysrmzqmzjd00000gn/T/go-build060803460=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
go test ./... -coverprofile=cover.out && go tool cover -html=cover.out
What did you expect to see?
There is a visible select box for choosing which file to look at.
What did you see instead?
A missing-but-clickable file chooser in the profile...  (See screenshot w/ HTML)

I cannot reproduce this close to head, but I also can't see how this can happen from cmd/cover's side. The HTML it generates for the <select> is quite simple.
Is it possible you have some Chrome extension hiding it? Can you try opening that coverage.html file in an incognito window to check?

@sblackstone See questions above.

I'm fairly convinced this isn't a bug in cmd/cover. It's most likely some issue in the user's browser.

authors: dsymonds ianlancetaylor sblackstone


text:
misc/wasm: isNodeJS does not work with Parcel

The Go webassembly loader that ships in misc/wasm/wasm_exec.js currently detects Node.JS using the following:
const isNodeJS = typeof process !== "undefined";

However, if you attempt to bundle it with some other code, for example, with Parcel, it adds a shim which breaks the previous check:
// shim for using process in browser
var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
// don't break things. …

This means that TextEncoder and the like are redefined to undefined and everything breaks.
I don't know anything about JavaScript or the JavaScript ecosystem, so I'm not sure if there's a better way to detect Node.JS, but maybe it would be better to detect individual features instead of trying to check what platform we're running on. Eg. instead of setting up TextEncoder if isNodeJS is false, check if global.TextEncoder is null and util.TextEncoder is not null.

CC @neelance

@SamWhited Would this work with Parcel?
const isNodeJS = typeof process !== "undefined" && process.title === "node";

authors: SamWhited bcmills neelance


text:
text/template: Inconsistent handling off nil values in if and with

package main

import (
	"bytes"
	"fmt"
	"log"
	"text/template"
)

type Niller interface {
	Nil() Niller
}

type Nill struct {
	nilv Niller
}

func (n Nill) Nil() Niller {
	return n.nilv
}

func main() {

	tmpl, err := template.New("").Parse(`{{ .Nil }}: {{ with .Nil }}Failed, got {{ . }}{{ else }}OK{{ end }}`)
	if err != nil {
		log.Fatal(err)
	}

	var (
		nil1 Niller = (*Nill)(nil)
		nil2 Niller
		nil3 *Nill
		nil4 Niller = nil
	)

	for i, niller := range []Niller{nil1, nil2, nil3, nil4} {
		var buff bytes.Buffer
		err = tmpl.Execute(&buff, &Nill{nilv: niller})
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(i+1, buff.String())
	}
}

The above prints:
1 <nil>: Failed, got <nil>
2 <nil>: OK
3 <nil>: Failed, got <nil>
4 <nil>: OK

This issue makes more sense if you also glance at these:

#30143 panic on nil interface value; it was when implementing workarounds for that issue that I got other curious nullpointers which I had hard time understanding. Unfortunately I found no workarounds that both avoid panics and work sensible with if and where.
#28391 about the subjective truth in template.IsTrue

The documentation for both if and with is similar:

"If the value of the pipeline is empty, no output is generated"

I'm not sure what the definition of "empty" in the above, but as all of the above cases outputs <nil>, I assume it is the truthines defined in template.IsTrue that is used.

CC @robpike @mvdan for text/template

Note that nil2 and nil4 in your example are identical values, and nil1 and nil3 are identical when stored in a []Niller.

“empty” in the context of “If the value of the pipeline is empty” means “equal to the zero value of its type”. At the core, this is another instance of https://golang.org/doc/faq#nil_error, and text/template is behaving as documented.

@bcmills I can sympathize with your urge to be effective and close this issue.  But this is a real issue that need some kind of action, even if just a documentation update.
In general, I think every person who uses the Go template API expect this to not panic with a nilpointer, if at all possible:
{{ with .MaybeNil }}{{ .Hello }}{{ end }}

Even after carefully reading the documentation, I think most people would expect the above to not crash. And note that this is less obvious and much harder to debug in a dynamic template context.
All of my 4 examples (even if there are duplicates) would be considered empty by most people.
There is nothing here that talks about "empty" (or even zero values), so that is, I guess, a vague sentence that could be interprited to mean just about anything.
/cc @mvdan @ianlancetaylor

I'm sure I'm talking to myself here, but if you expand the program above:
package main

import (
	"bytes"
	"fmt"
	"log"
	"text/template"
)

type Niller interface {
	Nil() Niller
	Foo() string
}

type Nill struct {
	nilv Niller
}

func (n Nill) Nil() Niller {
	return n.nilv
}

func (n Nill) Foo() string {
	return "asdf"
}

func main() {

	tmpl, err := template.New("").Parse(`{{ with .Nil }}Failed, got {{ . }}{{ else }}OK{{ end }}`)
	if err != nil {
		log.Fatal(err)
	}

	var (
		nil1 Niller = (*Nill)(nil)
		nil2 Niller
		nil3 *Nill
		nil4 Niller = nil
	)

	for i, niller := range []Niller{nil1, nil2, nil3, nil4} {

		var buff bytes.Buffer
		n := &Nill{nilv: niller}
		a, b := template.IsTrue(n.Nil())
		err = tmpl.Execute(&buff, n)
		if err != nil {
			fmt.Println("error:", err)
			continue
		}
		fmt.Println(i+1, a, b, buff.String())
	}
}

You get:
1 false true Failed, got <nil>
2 false true OK
3 false true Failed, got <nil>
4 false true OK

I have looked at the code, and I fail to understand it. template.IsTrue, which is used by with and if, all returns correctly false for all 4 cases, yet with (and if) behaves as if it was truthy.

I'm sure I'm talking to myself here

I did follow this thread yesterday, but I had work and a meetup to speak at, so I didn't have a chance to respond properly :)
I see you've opened a new issue, so I'll just focus on that one.

authors: bcmills bep mvdan


text:
x/playground: support custom GOPROXY

What version of Go are you using (go version)?
Playground depends upon docker build.  I'm using the default build args.

$ github.com/golang/playground@master

What did you do?
Install the go playground inside my company VPN.  I wrote a playground program that used internal only libraries.
What did you expect to see?
I expected my program to run.
What did you see instead?
The playground was unable to run my code.
The playground code hardcodes https://github.com/golang/playground/blob/a7b4d4c4bb72efd2ec20c9f30d5c1e6f09cee3d2/sandbox.go#L373 GOPROXY=https://proxy.golang.org.
I forked the playground code and replace GOPROXY=https://proxy.golang.org. with our company's internal athen's proxy GOPROXY=https://proxy.mycompany.intranet. . I was then able to use my company's internal software.
I would propose that the playground's Dockerfile https://github.com/golang/playground/blob/master/Dockerfile accept GOPROXY as an environment variable that configures where the playground uses the proxy

Seems fine with me. Mind submitting a patch that accepts an env var and defaults to https://proxy.golang.org if it’s not set?

Sure thing!


text:
Not able to get private go module while having port number in url

What version of Go are you using (go version)?

go1.14 windows/amd64

Does this issue reproduce with the latest release?
Yes

What did you do?
$ go get -u bitbucket.mycompany.com:8443/test/go-lib
What did you expect to see?
download the go-lib library
What did you see instead?
invalid char ':'

go get accepts a package list, not a list of URLs. Package paths do not contain port numbers.
(See https://tip.golang.org/cmd/go/#hdr-Remote_import_paths for a description of the protocol that the go command uses to resolve package paths to repo URLs.)

but I can't make the port disappear. is there a work around?

We no longer use the Go issue tracker for questions about usage: our experiment to allow questions on the issue tracker did not have the outcome we desired.
There are many other methods to get help if you're still looking for answers:

The golang-nuts mailing list.

Stack Overflow, with questions tagged go.

The Go Forum, a web-based forum hosted by GoBridge.

The Gophers Slack hosted by GopherAcademy; use the invite app for access.
The #general channel is a good starting point.

Go Community on Hashnode with questions and posts tagged with "go"

IRC channel #go-nuts on Freenode

Thanks

alright, posted here
https://stackoverflow.com/questions/60445266/not-able-to-get-private-go-module-while-having-port-number-in-url

authors: bcmills yhjhoo


text:
x/tools/gopls: "method textDocument/completion did not reply"

What did you do?

Use gopls with LanguageClient-neovim.
Open the file with the following contents:

package main

import "net"

type S struct {
	F int
}

func main() {
	s := S{}

}

Place the cursor on the empty line in main and type s.F, a = net,
LanguageClient-neovim triggers completion to show net contents.

The issue is not specific to the net package, but does not affect all packages. errors works correctly. net, os and github.com/wireguard/wgctrl-go do not.
I do not know whether the issue is specific to the LanguageClient-neovim behavior or not.
If the package is not imported and completeUnimported is enabled, completion is shown correctly.

What did you expect to see?
Completion popup with things exported by net .
What did you see instead?
gopls exits, no completion is shown. LanguageClient-neovim prints the following messages:
[LC] Error: Failure { jsonrpc: Some(V2), error: Error { code: InternalError, message: "method \"textDocument/completion\" did not reply", data: N
one }, id: Num(3) }
[LC] sending on a disconnected channel
[LC] sending on a disconnected channel

Last two are likely related to the gopls process exiting.
Build info
golang.org/x/tools/gopls v0.3.3
    golang.org/x/tools/gopls@v0.3.3 h1:mTFqRDJQmpSsgDDWvbtGnSva1z9uX2XcDszSWa6DhBQ=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200227200655-6862ededa516 h1:OX66ZzpltgCOuBSGdaeT77hS2z3ub2AB+EuGxvGRBLE=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info
go version go1.14 linux/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/foxcpp/.go/bin"
GOCACHE="/home/foxcpp/.cache/go-build"
GOENV="/home/foxcpp/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/foxcpp/.go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/foxcpp/gopls-bug/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build364981597=/tmp/go-build -gno-record-gcc-switches"

gopls.txt
gopls log with -rpc.trace. Also uploaded to https://hastebin.com/herurufoma.

Should be fixed by https://go-review.googlesource.com/c/tools/+/221020. The fix will be included in the next release. You can install from master in the meantime if you are hitting it a lot (it is triggered by the undeclared "a" identifier in the assignment.

Verified it is fixed at golang.org/x/tools/gopls@v0.1.8-0.20200316182129-bd88ce97550a. Thanks!

Thanks for confirming! I'll try to release gopls/v0.3.4 with this fix in the next few days.

authors: foxcpp muirdm stamblerre


text:
proposal: x/crypto/acme: support subproblems

What version of Go are you using (go version)?

$ go version
go version go1.13 linux/amd64

Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mpantheon/.cache/go-build"
GOENV="/home/mpantheon/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mpantheon/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build487582068=/tmp/go-build -gno-record-gcc-switches"

What did you do?
Called AuthorizeOrder to request a new ACMEv2 Order with identifiers rejected by the CA
What did you expect to see?
An acme.Error populated with RFC 8555 subproblems
What did you see instead?
An acme.Error with no subproblems available.
This limits the information clients can provide to users and prevents automated corrections to the invalid Order, such as by removing the the rejected identifiers and requesting a new Order.

/cc @FiloSottile @x1ddos

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

authors: mbaynton rsc toothrot


text:
Could you please rename master branch?

Go team has already removed references to those words in other code as I see. Why not change the branch name?
Please consider alternatives such as canary, develop and edge as main has a toxic history associated with it in Asian culture - https://www.nakasendoway.com/the-japanese-family-system/

"master" as used in the branch name comes from latin and just means "main", "principal", "central"; it has nothing to to with slavery or asian family dynamics.

authors: ALTree blacklivesmatterplease


text:
cmd/go: arbitrary code can be injected into cgo generated files [Go 1.15]

The go command may execute arbitrary code at build time when cgo is in use. This may occur when running go get on a malicious package, or any other command that builds untrusted code.
This can be caused by malicious unquoted symbol names. This has been fixed by rejecting invalid symbols which may add a //go:cgo_ldflag directive to the generated file, and by ensuring that the go tool follows existing LDFLAG restrictions.
Thanks to Chris Brown and Tempus Ex for reporting this issue.
This issue is CVE-2020-28366.

Github seems to have created a duplicate. Closing as duplicate of #42562


text:
How to imply memory barrier in go?

What version of Go are you using (go version)?

$ go version 1.15

What operating system and processor architecture are you using (go env)?
amd64

What did you do?
I implemented an inter-process shared memory queue with Golang.
I use an atomic.Value as an IPC mutex, but has problem on memory access sequence.
eg:
process 1 has:
var lock atomic.Value = (*byte)(shared_memory_addr + 0)
var ptr *byte = (*byte)(shared_memory_addr + 1000)
*ptr = 1
lock.Store(1)

process 2 has:
var lock atomic.Value = (*byte)(shared_memory_addr + 0)
var ptr *byte = (*byte)(shared_memory_addr + 1000)
for lock.Load() != 1 {
      continue
}
printf("%d",*ptr) // maybe not 1

What did you expect to see?
the *ptr should always be 1, but it sometimes can be 0.
Should I use assembly smb() or sth to ensure the correct order?
Is there some function like C++ std::atomic_thread_fence  in golang?

You should not need a fence to make that work. If an (*atomic.Value).Loadobserves the write from an (*atomic.Value).Store, then all future loads after the (*atomic.Value).Load should see all the stores before the (*atomic.Value).Store.
Can you show us a full program that demonstrates the problem?
Make sure you're obeying the restrictions on atomic.Value (no copying, multiple stores all have to be the same type).

Full program is:
package mq

import (
	"gw/pkg/shm"
	"gw/pkg/logs"
	"errors"
	"fmt"
	"reflect"
	"sync/atomic"
	"unsafe"
)

const headerSize = 1024
const packetHeaderSize = 4 + 4

func GetUint32(ptr uintptr) uint32 {
	return atomic.LoadUint32((*uint32)(unsafe.Pointer(ptr)))
}

func SetUint32(ptr uintptr, value uint32) {
	atomic.StoreUint32((*uint32)(unsafe.Pointer(ptr)), value)
}

func getAlignedSize(l uint32) uint32 {
	return (l + 7) / 8 * 8
}

type ShmHeader struct {
	ptr uintptr
}

func (h *ShmHeader) GetWriteBytes() uint32 {
	return GetUint32(h.ptr)
}
func (h *ShmHeader) SetWriteBytes(b uint32) {
	SetUint32(h.ptr, b)
}
func (h *ShmHeader) GetWriteOffset() uint32 {
	return GetUint32(h.ptr + 4)
}
func (h *ShmHeader) SetWriteOffset(b uint32) {
	SetUint32(h.ptr+4, b)
}
func (h *ShmHeader) GetReadBytes() uint32 {
	return GetUint32(h.ptr + 8)
}
func (h *ShmHeader) SetReadBytes(b uint32) {
	SetUint32(h.ptr+8, b)
}
func (h *ShmHeader) GetReadOffset() uint32 {
	return GetUint32(h.ptr + 12)
}
func (h *ShmHeader) SetReadOffset(b uint32) {
	SetUint32(h.ptr+12, b)
}

type PacketHeader struct {
	ptr uintptr
}

func (h *PacketHeader) GetLen() uint32 {
	return GetUint32(h.ptr)
}
func (h *PacketHeader) SetLen(l uint32) {
	SetUint32(h.ptr, l)
}
func (h PacketHeader) GetSeq() uint32 {
	return GetUint32(h.ptr + 4)
}
func (h PacketHeader) SetSeq(l uint32) {
	SetUint32(h.ptr+4, l)
}

type MqShm struct {
	shm           *shm.Memory
	header        ShmHeader
	content       []byte
	contentSize   uint32
	maxPacketSize uint32
	diffMax       uint32
	seq           uint32
	seqRead       uint32

}

func NewMqShm(name string, sizeData int32, maxPacketSize uint32, isCreate bool) (*MqShm, error) {
	size := sizeData + headerSize
	var m *shm.Memory
	var err error

	if isCreate {
		shm.Delete(name)
		m, err = shm.Create(name, size)
	} else {
		m, err = shm.Open(name, size)
	}
	if err != nil {
		logs.Error("shm: create error:name=%s,size=%d", name, size)
		return nil, err
	}

	header := ShmHeader{ptr: m.GetPtr()}

	var content []byte
	hc := (*reflect.SliceHeader)(unsafe.Pointer(&content))
	hc.Cap = int(sizeData)
	hc.Len = int(sizeData)
	hc.Data = m.GetPtr() + headerSize

	ret := &MqShm{
		shm:           m,
		header:        header,
		content:       content,
		contentSize:   uint32(sizeData),
		maxPacketSize: maxPacketSize,
	}
	//logs.Info("shm: create:name=%s, size=%d", name, size)
	return ret, nil
}

func (s *MqShm) Stop() {
	//logs.Info("shm: stop")
	s.shm.Close()
}

func (s *MqShm) Start() error {
	return nil
}

func (s *MqShm) getHeadInfo() string {
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	diffOff := uint32((((int)(wOff)-(int)(rOff))%(int)(s.contentSize) + (int)(s.contentSize)) % (int)(s.contentSize))
	rByte := s.header.GetReadBytes()
	wByte := s.header.GetWriteBytes()
	diffByte := wByte - rByte

	sRet := fmt.Sprintf("diffOff=%d, diffByte=%d, roff=%d, rbytes=%d, woff=%d, wbytes=%d", diffOff, diffByte, rOff, rByte, wOff, wByte)
	return sRet
}

func (s *MqShm) Read(buf []byte) (int, uint32, error) {
	//1. check empty
	if s.IsEmpty() {

		return 0, 0, nil
	}
	//2. read data
	start := s.header.GetReadOffset()
	packet := PacketHeader{ptr: s.header.ptr + uintptr(headerSize+start)}
	plen := int(packet.GetLen())
	uplen := getAlignedSize(uint32(plen))
	seq := packet.GetSeq()
	if plen == 0 {
		serr := fmt.Sprintf("read packet 0 size: %s", s.getHeadInfo())
		logs.Error(serr)
		return 0, 0, errors.New(serr)
	}
	//logs.Info("shm: read len=%d, seq=%d, roff=%d", plen, seq, s.header.GetReadOffset())
	if len(buf) < plen {
		serr := fmt.Sprintf("read packet too large: size=%d %s", plen, s.getHeadInfo())
		logs.Error(serr)
		return 0, 0, errors.New(serr)
	}

	s.seqRead = seq
	copy(buf, s.content[start+packetHeaderSize:uplen+start+packetHeaderSize])
	//3.move read ptr
	s.header.SetReadBytes(s.header.GetReadBytes() + uplen)
	//logs.Info("shm3: read len=%d, seq=%d, roff=%d", plen, seq, s.header.GetReadOffset())

	roff := s.header.GetReadOffset() + uplen + packetHeaderSize
	if roff >= s.contentSize-s.maxPacketSize-packetHeaderSize {
		roff = 0
	}
	s.header.SetReadOffset(roff)
	//logs.Info("shm: read(%d) len=%d, at pos:%d, next off:%d", seq, plen, start, roff)
	return plen, seq, nil
}

func (s *MqShm) Write(buf []byte) (int, uint32, error) {
	//0. check param
	plen := len(buf)
	uplen := getAlignedSize(uint32(plen))
	if uplen > s.maxPacketSize {
		logs.Error("shm: write too large")
		return 0, 0, fmt.Errorf("write buffer too large:%d", plen)
	}
	if plen == 0 {
		logs.Error("shm: write 0 size")
		return 0, 0, fmt.Errorf("write 0 size")
	}
	//1. check full
	if s.IsFull() {
		//s.checkLogOnce("write full")
		return 0, 0, nil
	}
	//2. write data
	start := s.header.GetWriteOffset()
	packet := PacketHeader{ptr: s.header.ptr + uintptr(headerSize+start)}
	packet.SetLen(uint32(plen))
	s.seq++
	packet.SetSeq(s.seq)

	copy(s.content[start+packetHeaderSize:uplen+start+packetHeaderSize], buf)

	//3.move write ptr
	s.header.SetWriteBytes(s.header.GetWriteBytes() + uplen)
	woff := s.header.GetWriteOffset() + uplen + packetHeaderSize
	if woff >= s.contentSize-s.maxPacketSize-packetHeaderSize {
		woff = 0
	}
	s.header.SetWriteOffset(woff)

	return plen, s.seq, nil
}

func (s *MqShm) IsEmpty() bool {
	r := s.header.GetReadBytes()
	w := s.header.GetWriteBytes()
	diff := w - r
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	return diff == 0 || (diff > 0x80000000 && rOff == wOff)
}

func (s *MqShm) IsFull() bool {
	if s.IsEmpty() {
		return false
	}
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	diff := uint32((((int)(wOff)-(int)(rOff))%(int)(s.contentSize) + (int)(s.contentSize)) % (int)(s.contentSize))
	if s.diffMax < diff {
		s.diffMax = diff
	}
	diffMax := s.contentSize - (s.maxPacketSize+packetHeaderSize)*2
	ret := diff > diffMax
	if ret {
		//logs.Infof("shm: full: diff = %d, roff:%d, woff:%d", diff, rOff, wOff)
	}
	return ret
}

func (s *MqShm) GetMaxUsed() uint32 {
	return s.diffMax
}

I checked the disassembly of Read:
TEXT code.byted.org/bytertc/rtcgw/internal/rtcmq.(*MqShm).Read(SB) /Users/zhangshishen/rtcgw/internal/rtcmq/mq_shm.go
  mq_shm.go:143		0x46f58c0		65488b0c2530000000		MOVQ GS:0x30, CX
  mq_shm.go:143		0x46f58c9		488d4424c0			LEAQ -0x40(SP), AX
  mq_shm.go:143		0x46f58ce		483b4110			CMPQ 0x10(CX), AX
  mq_shm.go:143		0x46f58d2		0f8692040000			JBE 0x46f5d6a
  mq_shm.go:143		0x46f58d8		4881ecc0000000			SUBQ $0xc0, SP
  mq_shm.go:143		0x46f58df		4889ac24b8000000		MOVQ BP, 0xb8(SP)
  mq_shm.go:143		0x46f58e7		488dac24b8000000		LEAQ 0xb8(SP), BP
  mq_shm.go:145		0x46f58ef		488b8424c8000000		MOVQ 0xc8(SP), AX
  mq_shm.go:145		0x46f58f7		48890424			MOVQ AX, 0(SP)
  mq_shm.go:145		0x46f58fb		e8c0070000			CALL code.byted.org/bytertc/rtcgw/internal/rtcmq.(*MqShm).IsEmpty(SB)
  mq_shm.go:145		0x46f5900		807c240800			CMPB $0x0, 0x8(SP)
  mq_shm.go:145		0x46f5905		0f8522040000			JNE 0x46f5d2d
  mq_shm.go:150		0x46f590b		488b9c24c8000000		MOVQ 0xc8(SP), BX
  mq_shm.go:150		0x46f5913		488b7308			MOVQ 0x8(BX), SI
  mq_shm.go:52		0x46f5917		4883c60c			ADDQ $0xc, SI
  mq_shm.go:18		0x46f591b		8b36				MOVL 0(SI), SI
  mq_shm.go:151		0x46f591d		48c744245800000000		MOVQ $0x0, 0x58(SP)
  mq_shm.go:151		0x46f5926		488b7b08			MOVQ 0x8(BX), DI
  mq_shm.go:151		0x46f592a		448d8600040000			LEAL 0x400(SI), R8
  mq_shm.go:151		0x46f5931		4c01c7				ADDQ R8, DI
  mq_shm.go:151		0x46f5934		48897c2458			MOVQ DI, 0x58(SP)
  mq_shm.go:63		0x46f5939		90				NOPL
  mq_shm.go:18		0x46f593a		8b3f				MOVL 0(DI), DI
  mq_shm.go:153		0x46f593c		90				NOPL
  mq_shm.go:154		0x46f593d		4c8b442458			MOVQ 0x58(SP), R8
  mq_shm.go:69		0x46f5942		4983c004			ADDQ $0x4, R8
  mq_shm.go:18		0x46f5946		458b00				MOVL 0(R8), R8
  mq_shm.go:152		0x46f5949		4189f9				MOVL DI, R9
  mq_shm.go:155		0x46f594c		4d85c9				TESTQ R9, R9
  mq_shm.go:155		0x46f594f		0f849f020000			JE 0x46f5bf4
  mq_shm.go:152		0x46f5955		4c894c2450			MOVQ R9, 0x50(SP)
  mq_shm.go:161		0x46f595a		4c8b9424d8000000		MOVQ 0xd8(SP), R10
  mq_shm.go:161		0x46f5962		4d39ca				CMPQ R9, R10
  mq_shm.go:161		0x46f5965		0f8cfa000000			JL 0x46f5a65
  mq_shm.go:167		0x46f596b		44894338			MOVL R8, 0x38(BX)
  mq_shm.go:168		0x46f596f		488b5320			MOVQ 0x20(BX), DX
  mq_shm.go:168		0x46f5973		4c8b5b10			MOVQ 0x10(BX), R11
  mq_shm.go:26		0x46f5977		83c707				ADDL $0x7, DI
  mq_shm.go:26		0x46f597a		c1ef03				SHRL $0x3, DI
  mq_shm.go:168		0x46f597d		8d0cfe				LEAL 0(SI)(DI*8), CX
  mq_shm.go:168		0x46f5980		8d4908				LEAL 0x8(CX), CX
  mq_shm.go:168		0x46f5983		4839d1				CMPQ DX, CX
  mq_shm.go:168		0x46f5986		0f87d8030000			JA 0x46f5d64
  mq_shm.go:168		0x46f598c		8d4608				LEAL 0x8(SI), AX
  mq_shm.go:168		0x46f598f		4839c8				CMPQ CX, AX
  mq_shm.go:168		0x46f5992		0f87c7030000			JA 0x46f5d5f
  mq_shm.go:168		0x46f5998		4829c1				SUBQ AX, CX
  mq_shm.go:168		0x46f599b		4939ca				CMPQ CX, R10
  mq_shm.go:168		0x46f599e		4c0f4fd1			CMOVG CX, R10
  mq_shm.go:168		0x46f59a2		89c1				MOVL AX, CX
  mq_shm.go:168		0x46f59a4		4829d0				SUBQ DX, AX
  mq_shm.go:168		0x46f59a7		48c1f83f			SARQ $0x3f, AX
  mq_shm.go:168		0x46f59ab		4821c1				ANDQ AX, CX
  mq_shm.go:168		0x46f59ae		498d040b			LEAQ 0(R11)(CX*1), AX
  mq_shm.go:168		0x46f59b2		488b8c24d0000000		MOVQ 0xd0(SP), CX
  mq_shm.go:168		0x46f59ba		4839c1				CMPQ AX, CX
  mq_shm.go:168		0x46f59bd		756f				JNE 0x46f5a2e
  mq_shm.go:46		0x46f59bf		488b4308			MOVQ 0x8(BX), AX
  mq_shm.go:46		0x46f59c3		4883c008			ADDQ $0x8, AX
  mq_shm.go:18		0x46f59c7		8b00				MOVL 0(AX), AX
  mq_shm.go:170		0x46f59c9		8d04f8				LEAL 0(AX)(DI*8), AX
  mq_shm.go:49		0x46f59cc		488b4b08			MOVQ 0x8(BX), CX
  mq_shm.go:49		0x46f59d0		4883c108			ADDQ $0x8, CX
  mq_shm.go:22		0x46f59d4		8701				XCHGL AX, 0(CX)
  mq_shm.go:52		0x46f59d6		488b4308			MOVQ 0x8(BX), AX
  mq_shm.go:52		0x46f59da		4883c00c			ADDQ $0xc, AX
  mq_shm.go:18		0x46f59de		8b00				MOVL 0(AX), AX
  mq_shm.go:173		0x46f59e0		8d04f8				LEAL 0(AX)(DI*8), AX
  mq_shm.go:173		0x46f59e3		8d4008				LEAL 0x8(AX), AX
  mq_shm.go:174		0x46f59e6		8b4b28				MOVL 0x28(BX), CX
  mq_shm.go:174		0x46f59e9		2b4b2c				SUBL 0x2c(BX), CX
  mq_shm.go:174		0x46f59ec		83c1f8				ADDL $-0x8, CX
  mq_shm.go:174		0x46f59ef		39c8				CMPL CX, AX
  mq_shm.go:177		0x46f59f1		b900000000			MOVL $0x0, CX
  mq_shm.go:177		0x46f59f6		0f43c1				CMOVAE CX, AX
  mq_shm.go:55		0x46f59f9		488b4b08			MOVQ 0x8(BX), CX
  mq_shm.go:55		0x46f59fd		4883c10c			ADDQ $0xc, CX
  mq_shm.go:22		0x46f5a01		8701				XCHGL AX, 0(CX)
  mq_shm.go:179		0x46f5a03		4c898c24e8000000		MOVQ R9, 0xe8(SP)
  mq_shm.go:179		0x46f5a0b		44898424f0000000		MOVL R8, 0xf0(SP)
  mq_shm.go:179		0x46f5a13		0f57c0				XORPS X0, X0
  mq_shm.go:179		0x46f5a16		0f118424f8000000		MOVUPS X0, 0xf8(SP)
  mq_shm.go:174		0x46f5a1e		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:174		0x46f5a26		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:174		0x46f5a2d		c3				RET
  mq_shm.go:18		0x46f5a2e		4489442438			MOVL R8, 0x38(SP)
  mq_shm.go:26		0x46f5a33		897c243c			MOVL DI, 0x3c(SP)
  mq_shm.go:168		0x46f5a37		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:168		0x46f5a3b		4889442408			MOVQ AX, 0x8(SP)
  mq_shm.go:168		0x46f5a40		4c89542410			MOVQ R10, 0x10(SP)
  mq_shm.go:168		0x46f5a45		e8364797ff			CALL runtime.memmove(SB)
  mq_shm.go:46		0x46f5a4a		488b9c24c8000000		MOVQ 0xc8(SP), BX
  mq_shm.go:170		0x46f5a52		8b7c243c			MOVL 0x3c(SP), DI
  mq_shm.go:179		0x46f5a56		448b442438			MOVL 0x38(SP), R8
  mq_shm.go:179		0x46f5a5b		4c8b4c2450			MOVQ 0x50(SP), R9
  mq_shm.go:168		0x46f5a60		e95affffff			JMP 0x46f59bf
  mq_shm.go:162		0x46f5a65		48891c24			MOVQ BX, 0(SP)
  mq_shm.go:162		0x46f5a69		e812fcffff			CALL code.byted.org/bytertc/rtcgw/internal/rtcmq.(*MqShm).getHeadInfo(SB)
  mq_shm.go:162		0x46f5a6e		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:162		0x46f5a73		4889442460			MOVQ AX, 0x60(SP)
  mq_shm.go:162		0x46f5a78		488b4c2408			MOVQ 0x8(SP), CX
  mq_shm.go:162		0x46f5a7d		48898c2480000000		MOVQ CX, 0x80(SP)
  mq_shm.go:162		0x46f5a85		488b542450			MOVQ 0x50(SP), DX
  mq_shm.go:162		0x46f5a8a		48891424			MOVQ DX, 0(SP)
  mq_shm.go:162		0x46f5a8e		e8ad6d91ff			CALL runtime.convT64(SB)
  mq_shm.go:162		0x46f5a93		488b442408			MOVQ 0x8(SP), AX
  mq_shm.go:162		0x46f5a98		4889442478			MOVQ AX, 0x78(SP)
  mq_shm.go:162		0x46f5a9d		488b8c2480000000		MOVQ 0x80(SP), CX
  mq_shm.go:162		0x46f5aa5		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:162		0x46f5aa9		488b4c2460			MOVQ 0x60(SP), CX
  mq_shm.go:162		0x46f5aae		48894c2408			MOVQ CX, 0x8(SP)
  mq_shm.go:162		0x46f5ab3		e8086e91ff			CALL runtime.convTstring(SB)
  mq_shm.go:162		0x46f5ab8		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:162		0x46f5abd		0f57c0				XORPS X0, X0
  mq_shm.go:162		0x46f5ac0		0f11842498000000		MOVUPS X0, 0x98(SP)
  mq_shm.go:162		0x46f5ac8		0f118424a8000000		MOVUPS X0, 0xa8(SP)
  mq_shm.go:162		0x46f5ad0		488d0d29f10800			LEAQ runtime.rodata+479744(SB), CX
  mq_shm.go:162		0x46f5ad7		48898c2498000000		MOVQ CX, 0x98(SP)
  mq_shm.go:162		0x46f5adf		488b4c2478			MOVQ 0x78(SP), CX
  mq_shm.go:162		0x46f5ae4		48898c24a0000000		MOVQ CX, 0xa0(SP)
  mq_shm.go:162		0x46f5aec		488d0d8dfd0800			LEAQ runtime.rodata+482944(SB), CX
  mq_shm.go:162		0x46f5af3		48898c24a8000000		MOVQ CX, 0xa8(SP)
  mq_shm.go:162		0x46f5afb		48898424b0000000		MOVQ AX, 0xb0(SP)
  mq_shm.go:162		0x46f5b03		488d052cbc1f00			LEAQ go.string.*+189518(SB), AX
  mq_shm.go:162		0x46f5b0a		48890424			MOVQ AX, 0(SP)
  mq_shm.go:162		0x46f5b0e		48c744240821000000		MOVQ $0x21, 0x8(SP)
  mq_shm.go:162		0x46f5b17		488d842498000000		LEAQ 0x98(SP), AX
  mq_shm.go:162		0x46f5b1f		4889442410			MOVQ AX, 0x10(SP)
  mq_shm.go:162		0x46f5b24		48c744241802000000		MOVQ $0x2, 0x18(SP)
  mq_shm.go:162		0x46f5b2d		48c744242002000000		MOVQ $0x2, 0x20(SP)
  mq_shm.go:162		0x46f5b36		e8d5999eff			CALL fmt.Sprintf(SB)
  mq_shm.go:162		0x46f5b3b		488b442430			MOVQ 0x30(SP), AX
  mq_shm.go:162		0x46f5b40		4889442440			MOVQ AX, 0x40(SP)
  mq_shm.go:162		0x46f5b45		488b4c2428			MOVQ 0x28(SP), CX
  mq_shm.go:162		0x46f5b4a		48894c2470			MOVQ CX, 0x70(SP)
  mq_shm.go:163		0x46f5b4f		90				NOPL
  logs.go:87		0x46f5b50		488b1529bc9600			MOVQ code.byted.org/gopkg/logs.defaultLogger(SB), DX
  logs.go:87		0x46f5b57		48891424			MOVQ DX, 0(SP)
  logs.go:87		0x46f5b5b		48894c2408			MOVQ CX, 0x8(SP)
  logs.go:87		0x46f5b60		4889442410			MOVQ AX, 0x10(SP)
  logs.go:87		0x46f5b65		0f57c0				XORPS X0, X0
  logs.go:87		0x46f5b68		0f11442418			MOVUPS X0, 0x18(SP)
  logs.go:87		0x46f5b6d		48c744242800000000		MOVQ $0x0, 0x28(SP)
  logs.go:87		0x46f5b76		e81560d7ff			CALL code.byted.org/gopkg/logs.(*Logger).Error(SB)
  errors.go:59		0x46f5b7b		488d059e650f00			LEAQ runtime.rodata+902944(SB), AX
  errors.go:59		0x46f5b82		48890424			MOVQ AX, 0(SP)
  errors.go:59		0x46f5b86		e8b59a91ff			CALL runtime.newobject(SB)
  errors.go:59		0x46f5b8b		488b7c2408			MOVQ 0x8(SP), DI
  errors.go:59		0x46f5b90		488b442440			MOVQ 0x40(SP), AX
  errors.go:59		0x46f5b95		48894708			MOVQ AX, 0x8(DI)
  errors.go:59		0x46f5b99		833d70c4990000			CMPL $0x0, runtime.writeBarrier(SB)
  errors.go:59		0x46f5ba0		7546				JNE 0x46f5be8
  errors.go:59		0x46f5ba2		488b442470			MOVQ 0x70(SP), AX
  errors.go:59		0x46f5ba7		488907				MOVQ AX, 0(DI)
  mq_shm.go:164		0x46f5baa		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:164		0x46f5bb6		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:164		0x46f5bc1		488d05b8692f00			LEAQ go.itab.*errors.errorString,error(SB), AX
  mq_shm.go:164		0x46f5bc8		48898424f8000000		MOVQ AX, 0xf8(SP)
  mq_shm.go:164		0x46f5bd0		4889bc2400010000		MOVQ DI, 0x100(SP)
  mq_shm.go:164		0x46f5bd8		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:164		0x46f5be0		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:164		0x46f5be7		c3				RET
  errors.go:59		0x46f5be8		488b442470			MOVQ 0x70(SP), AX
  errors.go:59		0x46f5bed		e8ee3397ff			CALL runtime.gcWriteBarrier(SB)
  errors.go:59		0x46f5bf2		ebb6				JMP 0x46f5baa
  mq_shm.go:156		0x46f5bf4		48891c24			MOVQ BX, 0(SP)
  mq_shm.go:156		0x46f5bf8		e883faffff			CALL code.byted.org/bytertc/rtcgw/internal/rtcmq.(*MqShm).getHeadInfo(SB)
  mq_shm.go:156		0x46f5bfd		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:156		0x46f5c02		488b4c2408			MOVQ 0x8(SP), CX
  mq_shm.go:156		0x46f5c07		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:156		0x46f5c0b		4889442408			MOVQ AX, 0x8(SP)
  mq_shm.go:156		0x46f5c10		e8ab6c91ff			CALL runtime.convTstring(SB)
  mq_shm.go:156		0x46f5c15		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:156		0x46f5c1a		0f57c0				XORPS X0, X0
  mq_shm.go:156		0x46f5c1d		0f11842488000000		MOVUPS X0, 0x88(SP)
  mq_shm.go:156		0x46f5c25		488d0d54fc0800			LEAQ runtime.rodata+482944(SB), CX
  mq_shm.go:156		0x46f5c2c		48898c2488000000		MOVQ CX, 0x88(SP)
  mq_shm.go:156		0x46f5c34		4889842490000000		MOVQ AX, 0x90(SP)
  mq_shm.go:156		0x46f5c3c		488d05b1091f00			LEAQ go.string.*+144140(SB), AX
  mq_shm.go:156		0x46f5c43		48890424			MOVQ AX, 0(SP)
  mq_shm.go:156		0x46f5c47		48c744240816000000		MOVQ $0x16, 0x8(SP)
  mq_shm.go:156		0x46f5c50		488d842488000000		LEAQ 0x88(SP), AX
  mq_shm.go:156		0x46f5c58		4889442410			MOVQ AX, 0x10(SP)
  mq_shm.go:156		0x46f5c5d		48c744241801000000		MOVQ $0x1, 0x18(SP)
  mq_shm.go:156		0x46f5c66		48c744242001000000		MOVQ $0x1, 0x20(SP)
  mq_shm.go:156		0x46f5c6f		e89c989eff			CALL fmt.Sprintf(SB)
  mq_shm.go:156		0x46f5c74		488b442430			MOVQ 0x30(SP), AX
  mq_shm.go:156		0x46f5c79		4889442448			MOVQ AX, 0x48(SP)
  mq_shm.go:156		0x46f5c7e		488b4c2428			MOVQ 0x28(SP), CX
  mq_shm.go:156		0x46f5c83		48894c2468			MOVQ CX, 0x68(SP)
  mq_shm.go:157		0x46f5c88		90				NOPL
  logs.go:87		0x46f5c89		488b15f0ba9600			MOVQ code.byted.org/gopkg/logs.defaultLogger(SB), DX
  logs.go:87		0x46f5c90		48891424			MOVQ DX, 0(SP)
  logs.go:87		0x46f5c94		48894c2408			MOVQ CX, 0x8(SP)
  logs.go:87		0x46f5c99		4889442410			MOVQ AX, 0x10(SP)
  logs.go:87		0x46f5c9e		0f57c0				XORPS X0, X0
  logs.go:87		0x46f5ca1		0f11442418			MOVUPS X0, 0x18(SP)
  logs.go:87		0x46f5ca6		48c744242800000000		MOVQ $0x0, 0x28(SP)
  logs.go:87		0x46f5caf		e8dc5ed7ff			CALL code.byted.org/gopkg/logs.(*Logger).Error(SB)
  errors.go:59		0x46f5cb4		488d0565640f00			LEAQ runtime.rodata+902944(SB), AX
  errors.go:59		0x46f5cbb		48890424			MOVQ AX, 0(SP)
  errors.go:59		0x46f5cbf		e87c9991ff			CALL runtime.newobject(SB)
  errors.go:59		0x46f5cc4		488b7c2408			MOVQ 0x8(SP), DI
  errors.go:59		0x46f5cc9		488b442448			MOVQ 0x48(SP), AX
  errors.go:59		0x46f5cce		48894708			MOVQ AX, 0x8(DI)
  errors.go:59		0x46f5cd2		833d37c3990000			CMPL $0x0, runtime.writeBarrier(SB)
  errors.go:59		0x46f5cd9		7546				JNE 0x46f5d21
  errors.go:59		0x46f5cdb		488b442468			MOVQ 0x68(SP), AX
  errors.go:59		0x46f5ce0		488907				MOVQ AX, 0(DI)
  mq_shm.go:158		0x46f5ce3		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:158		0x46f5cef		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:158		0x46f5cfa		488d057f682f00			LEAQ go.itab.*errors.errorString,error(SB), AX
  mq_shm.go:158		0x46f5d01		48898424f8000000		MOVQ AX, 0xf8(SP)
  mq_shm.go:158		0x46f5d09		4889bc2400010000		MOVQ DI, 0x100(SP)
  mq_shm.go:158		0x46f5d11		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:158		0x46f5d19		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:158		0x46f5d20		c3				RET
  errors.go:59		0x46f5d21		488b442468			MOVQ 0x68(SP), AX
  errors.go:59		0x46f5d26		e8b53297ff			CALL runtime.gcWriteBarrier(SB)
  errors.go:59		0x46f5d2b		ebb6				JMP 0x46f5ce3
  mq_shm.go:147		0x46f5d2d		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:147		0x46f5d39		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:147		0x46f5d44		0f57c0				XORPS X0, X0
  mq_shm.go:147		0x46f5d47		0f118424f8000000		MOVUPS X0, 0xf8(SP)
  mq_shm.go:147		0x46f5d4f		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:147		0x46f5d57		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:147		0x46f5d5e		c3				RET
  mq_shm.go:168		0x46f5d5f		e84c3c97ff			CALL runtime.panicSliceB(SB)
  mq_shm.go:168		0x46f5d64		e8273c97ff			CALL runtime.panicSliceAcap(SB)
  mq_shm.go:168		0x46f5d69		90				NOPL
  mq_shm.go:143		0x46f5d6a		e8d11297ff			CALL runtime.morestack_noctxt(SB)
  mq_shm.go:143		0x46f5d6f		e94cfbffff			JMP code.byted.org/bytertc/rtcgw/internal/rtcmq.(*MqShm).Read(SB)
  :-1			0x46f5d74		cc				INT $0x3
  :-1			0x46f5d75		cc				INT $0x3
  :-1			0x46f5d76		cc				INT $0x3
  :-1			0x46f5d77		cc				INT $0x3
  :-1			0x46f5d78		cc				INT $0x3
  :-1			0x46f5d79		cc				INT $0x3
  :-1			0x46f5d7a		cc				INT $0x3
  :-1			0x46f5d7b		cc				INT $0x3
  :-1			0x46f5d7c		cc				INT $0x3
  :-1			0x46f5d7d		cc				INT $0x3
  :-1			0x46f5d7e		cc				INT $0x3
  :-1			0x46f5d7f		cc				INT $0x3

It seems function copy(buf, s.content[start+packetHeaderSize:uplen+start+packetHeaderSize]) is after atomic memory store s.header.SetWriteOffset(woff) which will cause error.

Full program is:
package mq

import (
	"gw/pkg/shm"
	"gw/pkg/logs"
	"errors"
	"fmt"
	"reflect"
	"sync/atomic"
	"unsafe"
)

const headerSize = 1024
const packetHeaderSize = 4 + 4

func GetUint32(ptr uintptr) uint32 {
	return atomic.LoadUint32((*uint32)(unsafe.Pointer(ptr)))
}

func SetUint32(ptr uintptr, value uint32) {
	atomic.StoreUint32((*uint32)(unsafe.Pointer(ptr)), value)
}

func getAlignedSize(l uint32) uint32 {
	return (l + 7) / 8 * 8
}

type ShmHeader struct {
	ptr uintptr
}

func (h *ShmHeader) GetWriteBytes() uint32 {
	return GetUint32(h.ptr)
}
func (h *ShmHeader) SetWriteBytes(b uint32) {
	SetUint32(h.ptr, b)
}
func (h *ShmHeader) GetWriteOffset() uint32 {
	return GetUint32(h.ptr + 4)
}
func (h *ShmHeader) SetWriteOffset(b uint32) {
	SetUint32(h.ptr+4, b)
}
func (h *ShmHeader) GetReadBytes() uint32 {
	return GetUint32(h.ptr + 8)
}
func (h *ShmHeader) SetReadBytes(b uint32) {
	SetUint32(h.ptr+8, b)
}
func (h *ShmHeader) GetReadOffset() uint32 {
	return GetUint32(h.ptr + 12)
}
func (h *ShmHeader) SetReadOffset(b uint32) {
	SetUint32(h.ptr+12, b)
}

type PacketHeader struct {
	ptr uintptr
}

func (h *PacketHeader) GetLen() uint32 {
	return GetUint32(h.ptr)
}
func (h *PacketHeader) SetLen(l uint32) {
	SetUint32(h.ptr, l)
}
func (h PacketHeader) GetSeq() uint32 {
	return GetUint32(h.ptr + 4)
}
func (h PacketHeader) SetSeq(l uint32) {
	SetUint32(h.ptr+4, l)
}

type MqShm struct {
	shm           *shm.Memory
	header        ShmHeader
	content       []byte
	contentSize   uint32
	maxPacketSize uint32
	diffMax       uint32
	seq           uint32
	seqRead       uint32

}

func NewMqShm(name string, sizeData int32, maxPacketSize uint32, isCreate bool) (*MqShm, error) {
	size := sizeData + headerSize
	var m *shm.Memory
	var err error

	if isCreate {
		shm.Delete(name)
		m, err = shm.Create(name, size)
	} else {
		m, err = shm.Open(name, size)
	}
	if err != nil {
		logs.Error("shm: create error:name=%s,size=%d", name, size)
		return nil, err
	}

	header := ShmHeader{ptr: m.GetPtr()}

	var content []byte
	hc := (*reflect.SliceHeader)(unsafe.Pointer(&content))
	hc.Cap = int(sizeData)
	hc.Len = int(sizeData)
	hc.Data = m.GetPtr() + headerSize

	ret := &MqShm{
		shm:           m,
		header:        header,
		content:       content,
		contentSize:   uint32(sizeData),
		maxPacketSize: maxPacketSize,
	}
	//logs.Info("shm: create:name=%s, size=%d", name, size)
	return ret, nil
}

func (s *MqShm) Stop() {
	//logs.Info("shm: stop")
	s.shm.Close()
}

func (s *MqShm) Start() error {
	return nil
}

func (s *MqShm) getHeadInfo() string {
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	diffOff := uint32((((int)(wOff)-(int)(rOff))%(int)(s.contentSize) + (int)(s.contentSize)) % (int)(s.contentSize))
	rByte := s.header.GetReadBytes()
	wByte := s.header.GetWriteBytes()
	diffByte := wByte - rByte

	sRet := fmt.Sprintf("diffOff=%d, diffByte=%d, roff=%d, rbytes=%d, woff=%d, wbytes=%d", diffOff, diffByte, rOff, rByte, wOff, wByte)
	return sRet
}

func (s *MqShm) Read(buf []byte) (int, uint32, error) {
	//1. check empty
	if s.IsEmpty() {

		return 0, 0, nil
	}
	//2. read data
	start := s.header.GetReadOffset()
	packet := PacketHeader{ptr: s.header.ptr + uintptr(headerSize+start)}
	plen := int(packet.GetLen())
	uplen := getAlignedSize(uint32(plen))
	seq := packet.GetSeq()
	if plen == 0 {
		serr := fmt.Sprintf("read packet 0 size: %s", s.getHeadInfo())
		logs.Error(serr)
		return 0, 0, errors.New(serr)
	}
	//logs.Info("shm: read len=%d, seq=%d, roff=%d", plen, seq, s.header.GetReadOffset())
	if len(buf) < plen {
		serr := fmt.Sprintf("read packet too large: size=%d %s", plen, s.getHeadInfo())
		logs.Error(serr)
		return 0, 0, errors.New(serr)
	}

	s.seqRead = seq
	copy(buf, s.content[start+packetHeaderSize:uplen+start+packetHeaderSize])
	//3.move read ptr
	s.header.SetReadBytes(s.header.GetReadBytes() + uplen)
	//logs.Info("shm3: read len=%d, seq=%d, roff=%d", plen, seq, s.header.GetReadOffset())

	roff := s.header.GetReadOffset() + uplen + packetHeaderSize
	if roff >= s.contentSize-s.maxPacketSize-packetHeaderSize {
		roff = 0
	}
	s.header.SetReadOffset(roff)
	//logs.Info("shm: read(%d) len=%d, at pos:%d, next off:%d", seq, plen, start, roff)
	return plen, seq, nil
}

func (s *MqShm) Write(buf []byte) (int, uint32, error) {
	//0. check param
	plen := len(buf)
	uplen := getAlignedSize(uint32(plen))
	if uplen > s.maxPacketSize {
		logs.Error("shm: write too large")
		return 0, 0, fmt.Errorf("write buffer too large:%d", plen)
	}
	if plen == 0 {
		logs.Error("shm: write 0 size")
		return 0, 0, fmt.Errorf("write 0 size")
	}
	//1. check full
	if s.IsFull() {
		//s.checkLogOnce("write full")
		return 0, 0, nil
	}
	//2. write data
	start := s.header.GetWriteOffset()
	packet := PacketHeader{ptr: s.header.ptr + uintptr(headerSize+start)}
	packet.SetLen(uint32(plen))
	s.seq++
	packet.SetSeq(s.seq)

	copy(s.content[start+packetHeaderSize:uplen+start+packetHeaderSize], buf)

	//3.move write ptr
	s.header.SetWriteBytes(s.header.GetWriteBytes() + uplen)
	woff := s.header.GetWriteOffset() + uplen + packetHeaderSize
	if woff >= s.contentSize-s.maxPacketSize-packetHeaderSize {
		woff = 0
	}
	s.header.SetWriteOffset(woff)

	return plen, s.seq, nil
}

func (s *MqShm) IsEmpty() bool {
	r := s.header.GetReadBytes()
	w := s.header.GetWriteBytes()
	diff := w - r
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	return diff == 0 || (diff > 0x80000000 && rOff == wOff)
}

func (s *MqShm) IsFull() bool {
	if s.IsEmpty() {
		return false
	}
	rOff := s.header.GetReadOffset()
	wOff := s.header.GetWriteOffset()
	diff := uint32((((int)(wOff)-(int)(rOff))%(int)(s.contentSize) + (int)(s.contentSize)) % (int)(s.contentSize))
	if s.diffMax < diff {
		s.diffMax = diff
	}
	diffMax := s.contentSize - (s.maxPacketSize+packetHeaderSize)*2
	ret := diff > diffMax
	if ret {
		//logs.Infof("shm: full: diff = %d, roff:%d, woff:%d", diff, rOff, wOff)
	}
	return ret
}

func (s *MqShm) GetMaxUsed() uint32 {
	return s.diffMax
}

I checked the disassembly of Read:
TEXT gw/internal/rtcmq.(*MqShm).Read(SB) gw/internal/rtcmq/mq_shm.go
  mq_shm.go:143		0x46f58c0		65488b0c2530000000		MOVQ GS:0x30, CX
  mq_shm.go:143		0x46f58c9		488d4424c0			LEAQ -0x40(SP), AX
  mq_shm.go:143		0x46f58ce		483b4110			CMPQ 0x10(CX), AX
  mq_shm.go:143		0x46f58d2		0f8692040000			JBE 0x46f5d6a
  mq_shm.go:143		0x46f58d8		4881ecc0000000			SUBQ $0xc0, SP
  mq_shm.go:143		0x46f58df		4889ac24b8000000		MOVQ BP, 0xb8(SP)
  mq_shm.go:143		0x46f58e7		488dac24b8000000		LEAQ 0xb8(SP), BP
  mq_shm.go:145		0x46f58ef		488b8424c8000000		MOVQ 0xc8(SP), AX
  mq_shm.go:145		0x46f58f7		48890424			MOVQ AX, 0(SP)
  mq_shm.go:145		0x46f58fb		e8c0070000			CALL gw/internal/rtcmq.(*MqShm).IsEmpty(SB)
  mq_shm.go:145		0x46f5900		807c240800			CMPB $0x0, 0x8(SP)
  mq_shm.go:145		0x46f5905		0f8522040000			JNE 0x46f5d2d
  mq_shm.go:150		0x46f590b		488b9c24c8000000		MOVQ 0xc8(SP), BX
  mq_shm.go:150		0x46f5913		488b7308			MOVQ 0x8(BX), SI
  mq_shm.go:52		0x46f5917		4883c60c			ADDQ $0xc, SI
  mq_shm.go:18		0x46f591b		8b36				MOVL 0(SI), SI
  mq_shm.go:151		0x46f591d		48c744245800000000		MOVQ $0x0, 0x58(SP)
  mq_shm.go:151		0x46f5926		488b7b08			MOVQ 0x8(BX), DI
  mq_shm.go:151		0x46f592a		448d8600040000			LEAL 0x400(SI), R8
  mq_shm.go:151		0x46f5931		4c01c7				ADDQ R8, DI
  mq_shm.go:151		0x46f5934		48897c2458			MOVQ DI, 0x58(SP)
  mq_shm.go:63		0x46f5939		90				NOPL
  mq_shm.go:18		0x46f593a		8b3f				MOVL 0(DI), DI
  mq_shm.go:153		0x46f593c		90				NOPL
  mq_shm.go:154		0x46f593d		4c8b442458			MOVQ 0x58(SP), R8
  mq_shm.go:69		0x46f5942		4983c004			ADDQ $0x4, R8
  mq_shm.go:18		0x46f5946		458b00				MOVL 0(R8), R8
  mq_shm.go:152		0x46f5949		4189f9				MOVL DI, R9
  mq_shm.go:155		0x46f594c		4d85c9				TESTQ R9, R9
  mq_shm.go:155		0x46f594f		0f849f020000			JE 0x46f5bf4
  mq_shm.go:152		0x46f5955		4c894c2450			MOVQ R9, 0x50(SP)
  mq_shm.go:161		0x46f595a		4c8b9424d8000000		MOVQ 0xd8(SP), R10
  mq_shm.go:161		0x46f5962		4d39ca				CMPQ R9, R10
  mq_shm.go:161		0x46f5965		0f8cfa000000			JL 0x46f5a65
  mq_shm.go:167		0x46f596b		44894338			MOVL R8, 0x38(BX)
  mq_shm.go:168		0x46f596f		488b5320			MOVQ 0x20(BX), DX
  mq_shm.go:168		0x46f5973		4c8b5b10			MOVQ 0x10(BX), R11
  mq_shm.go:26		0x46f5977		83c707				ADDL $0x7, DI
  mq_shm.go:26		0x46f597a		c1ef03				SHRL $0x3, DI
  mq_shm.go:168		0x46f597d		8d0cfe				LEAL 0(SI)(DI*8), CX
  mq_shm.go:168		0x46f5980		8d4908				LEAL 0x8(CX), CX
  mq_shm.go:168		0x46f5983		4839d1				CMPQ DX, CX
  mq_shm.go:168		0x46f5986		0f87d8030000			JA 0x46f5d64
  mq_shm.go:168		0x46f598c		8d4608				LEAL 0x8(SI), AX
  mq_shm.go:168		0x46f598f		4839c8				CMPQ CX, AX
  mq_shm.go:168		0x46f5992		0f87c7030000			JA 0x46f5d5f
  mq_shm.go:168		0x46f5998		4829c1				SUBQ AX, CX
  mq_shm.go:168		0x46f599b		4939ca				CMPQ CX, R10
  mq_shm.go:168		0x46f599e		4c0f4fd1			CMOVG CX, R10
  mq_shm.go:168		0x46f59a2		89c1				MOVL AX, CX
  mq_shm.go:168		0x46f59a4		4829d0				SUBQ DX, AX
  mq_shm.go:168		0x46f59a7		48c1f83f			SARQ $0x3f, AX
  mq_shm.go:168		0x46f59ab		4821c1				ANDQ AX, CX
  mq_shm.go:168		0x46f59ae		498d040b			LEAQ 0(R11)(CX*1), AX
  mq_shm.go:168		0x46f59b2		488b8c24d0000000		MOVQ 0xd0(SP), CX
  mq_shm.go:168		0x46f59ba		4839c1				CMPQ AX, CX
  mq_shm.go:168		0x46f59bd		756f				JNE 0x46f5a2e
  mq_shm.go:46		0x46f59bf		488b4308			MOVQ 0x8(BX), AX
  mq_shm.go:46		0x46f59c3		4883c008			ADDQ $0x8, AX
  mq_shm.go:18		0x46f59c7		8b00				MOVL 0(AX), AX
  mq_shm.go:170		0x46f59c9		8d04f8				LEAL 0(AX)(DI*8), AX
  mq_shm.go:49		0x46f59cc		488b4b08			MOVQ 0x8(BX), CX
  mq_shm.go:49		0x46f59d0		4883c108			ADDQ $0x8, CX
  mq_shm.go:22		0x46f59d4		8701				XCHGL AX, 0(CX)
  mq_shm.go:52		0x46f59d6		488b4308			MOVQ 0x8(BX), AX
  mq_shm.go:52		0x46f59da		4883c00c			ADDQ $0xc, AX
  mq_shm.go:18		0x46f59de		8b00				MOVL 0(AX), AX
  mq_shm.go:173		0x46f59e0		8d04f8				LEAL 0(AX)(DI*8), AX
  mq_shm.go:173		0x46f59e3		8d4008				LEAL 0x8(AX), AX
  mq_shm.go:174		0x46f59e6		8b4b28				MOVL 0x28(BX), CX
  mq_shm.go:174		0x46f59e9		2b4b2c				SUBL 0x2c(BX), CX
  mq_shm.go:174		0x46f59ec		83c1f8				ADDL $-0x8, CX
  mq_shm.go:174		0x46f59ef		39c8				CMPL CX, AX
  mq_shm.go:177		0x46f59f1		b900000000			MOVL $0x0, CX
  mq_shm.go:177		0x46f59f6		0f43c1				CMOVAE CX, AX
  mq_shm.go:55		0x46f59f9		488b4b08			MOVQ 0x8(BX), CX
  mq_shm.go:55		0x46f59fd		4883c10c			ADDQ $0xc, CX
  mq_shm.go:22		0x46f5a01		8701				XCHGL AX, 0(CX)
  mq_shm.go:179		0x46f5a03		4c898c24e8000000		MOVQ R9, 0xe8(SP)
  mq_shm.go:179		0x46f5a0b		44898424f0000000		MOVL R8, 0xf0(SP)
  mq_shm.go:179		0x46f5a13		0f57c0				XORPS X0, X0
  mq_shm.go:179		0x46f5a16		0f118424f8000000		MOVUPS X0, 0xf8(SP)
  mq_shm.go:174		0x46f5a1e		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:174		0x46f5a26		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:174		0x46f5a2d		c3				RET
  mq_shm.go:18		0x46f5a2e		4489442438			MOVL R8, 0x38(SP)
  mq_shm.go:26		0x46f5a33		897c243c			MOVL DI, 0x3c(SP)
  mq_shm.go:168		0x46f5a37		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:168		0x46f5a3b		4889442408			MOVQ AX, 0x8(SP)
  mq_shm.go:168		0x46f5a40		4c89542410			MOVQ R10, 0x10(SP)
  mq_shm.go:168		0x46f5a45		e8364797ff			CALL runtime.memmove(SB)
  mq_shm.go:46		0x46f5a4a		488b9c24c8000000		MOVQ 0xc8(SP), BX
  mq_shm.go:170		0x46f5a52		8b7c243c			MOVL 0x3c(SP), DI
  mq_shm.go:179		0x46f5a56		448b442438			MOVL 0x38(SP), R8
  mq_shm.go:179		0x46f5a5b		4c8b4c2450			MOVQ 0x50(SP), R9
  mq_shm.go:168		0x46f5a60		e95affffff			JMP 0x46f59bf
  mq_shm.go:162		0x46f5a65		48891c24			MOVQ BX, 0(SP)
  mq_shm.go:162		0x46f5a69		e812fcffff			CALL gw/internal/rtcmq.(*MqShm).getHeadInfo(SB)
  mq_shm.go:162		0x46f5a6e		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:162		0x46f5a73		4889442460			MOVQ AX, 0x60(SP)
  mq_shm.go:162		0x46f5a78		488b4c2408			MOVQ 0x8(SP), CX
  mq_shm.go:162		0x46f5a7d		48898c2480000000		MOVQ CX, 0x80(SP)
  mq_shm.go:162		0x46f5a85		488b542450			MOVQ 0x50(SP), DX
  mq_shm.go:162		0x46f5a8a		48891424			MOVQ DX, 0(SP)
  mq_shm.go:162		0x46f5a8e		e8ad6d91ff			CALL runtime.convT64(SB)
  mq_shm.go:162		0x46f5a93		488b442408			MOVQ 0x8(SP), AX
  mq_shm.go:162		0x46f5a98		4889442478			MOVQ AX, 0x78(SP)
  mq_shm.go:162		0x46f5a9d		488b8c2480000000		MOVQ 0x80(SP), CX
  mq_shm.go:162		0x46f5aa5		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:162		0x46f5aa9		488b4c2460			MOVQ 0x60(SP), CX
  mq_shm.go:162		0x46f5aae		48894c2408			MOVQ CX, 0x8(SP)
  mq_shm.go:162		0x46f5ab3		e8086e91ff			CALL runtime.convTstring(SB)
  mq_shm.go:162		0x46f5ab8		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:162		0x46f5abd		0f57c0				XORPS X0, X0
  mq_shm.go:162		0x46f5ac0		0f11842498000000		MOVUPS X0, 0x98(SP)
  mq_shm.go:162		0x46f5ac8		0f118424a8000000		MOVUPS X0, 0xa8(SP)
  mq_shm.go:162		0x46f5ad0		488d0d29f10800			LEAQ runtime.rodata+479744(SB), CX
  mq_shm.go:162		0x46f5ad7		48898c2498000000		MOVQ CX, 0x98(SP)
  mq_shm.go:162		0x46f5adf		488b4c2478			MOVQ 0x78(SP), CX
  mq_shm.go:162		0x46f5ae4		48898c24a0000000		MOVQ CX, 0xa0(SP)
  mq_shm.go:162		0x46f5aec		488d0d8dfd0800			LEAQ runtime.rodata+482944(SB), CX
  mq_shm.go:162		0x46f5af3		48898c24a8000000		MOVQ CX, 0xa8(SP)
  mq_shm.go:162		0x46f5afb		48898424b0000000		MOVQ AX, 0xb0(SP)
  mq_shm.go:162		0x46f5b03		488d052cbc1f00			LEAQ go.string.*+189518(SB), AX
  mq_shm.go:162		0x46f5b0a		48890424			MOVQ AX, 0(SP)
  mq_shm.go:162		0x46f5b0e		48c744240821000000		MOVQ $0x21, 0x8(SP)
  mq_shm.go:162		0x46f5b17		488d842498000000		LEAQ 0x98(SP), AX
  mq_shm.go:162		0x46f5b1f		4889442410			MOVQ AX, 0x10(SP)
  mq_shm.go:162		0x46f5b24		48c744241802000000		MOVQ $0x2, 0x18(SP)
  mq_shm.go:162		0x46f5b2d		48c744242002000000		MOVQ $0x2, 0x20(SP)
  mq_shm.go:162		0x46f5b36		e8d5999eff			CALL fmt.Sprintf(SB)
  mq_shm.go:162		0x46f5b3b		488b442430			MOVQ 0x30(SP), AX
  mq_shm.go:162		0x46f5b40		4889442440			MOVQ AX, 0x40(SP)
  mq_shm.go:162		0x46f5b45		488b4c2428			MOVQ 0x28(SP), CX
  mq_shm.go:162		0x46f5b4a		48894c2470			MOVQ CX, 0x70(SP)
  mq_shm.go:163		0x46f5b4f		90				NOPL
  logs.go:87		0x46f5b50		488b1529bc9600			MOVQ gw/gopkg/logs.defaultLogger(SB), DX
  logs.go:87		0x46f5b57		48891424			MOVQ DX, 0(SP)
  logs.go:87		0x46f5b5b		48894c2408			MOVQ CX, 0x8(SP)
  logs.go:87		0x46f5b60		4889442410			MOVQ AX, 0x10(SP)
  logs.go:87		0x46f5b65		0f57c0				XORPS X0, X0
  logs.go:87		0x46f5b68		0f11442418			MOVUPS X0, 0x18(SP)
  logs.go:87		0x46f5b6d		48c744242800000000		MOVQ $0x0, 0x28(SP)
  logs.go:87		0x46f5b76		e81560d7ff			CALL gw/gopkg/logs.(*Logger).Error(SB)
  errors.go:59		0x46f5b7b		488d059e650f00			LEAQ runtime.rodata+902944(SB), AX
  errors.go:59		0x46f5b82		48890424			MOVQ AX, 0(SP)
  errors.go:59		0x46f5b86		e8b59a91ff			CALL runtime.newobject(SB)
  errors.go:59		0x46f5b8b		488b7c2408			MOVQ 0x8(SP), DI
  errors.go:59		0x46f5b90		488b442440			MOVQ 0x40(SP), AX
  errors.go:59		0x46f5b95		48894708			MOVQ AX, 0x8(DI)
  errors.go:59		0x46f5b99		833d70c4990000			CMPL $0x0, runtime.writeBarrier(SB)
  errors.go:59		0x46f5ba0		7546				JNE 0x46f5be8
  errors.go:59		0x46f5ba2		488b442470			MOVQ 0x70(SP), AX
  errors.go:59		0x46f5ba7		488907				MOVQ AX, 0(DI)
  mq_shm.go:164		0x46f5baa		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:164		0x46f5bb6		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:164		0x46f5bc1		488d05b8692f00			LEAQ go.itab.*errors.errorString,error(SB), AX
  mq_shm.go:164		0x46f5bc8		48898424f8000000		MOVQ AX, 0xf8(SP)
  mq_shm.go:164		0x46f5bd0		4889bc2400010000		MOVQ DI, 0x100(SP)
  mq_shm.go:164		0x46f5bd8		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:164		0x46f5be0		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:164		0x46f5be7		c3				RET
  errors.go:59		0x46f5be8		488b442470			MOVQ 0x70(SP), AX
  errors.go:59		0x46f5bed		e8ee3397ff			CALL runtime.gcWriteBarrier(SB)
  errors.go:59		0x46f5bf2		ebb6				JMP 0x46f5baa
  mq_shm.go:156		0x46f5bf4		48891c24			MOVQ BX, 0(SP)
  mq_shm.go:156		0x46f5bf8		e883faffff			CALL gw/internal/rtcmq.(*MqShm).getHeadInfo(SB)
  mq_shm.go:156		0x46f5bfd		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:156		0x46f5c02		488b4c2408			MOVQ 0x8(SP), CX
  mq_shm.go:156		0x46f5c07		48890c24			MOVQ CX, 0(SP)
  mq_shm.go:156		0x46f5c0b		4889442408			MOVQ AX, 0x8(SP)
  mq_shm.go:156		0x46f5c10		e8ab6c91ff			CALL runtime.convTstring(SB)
  mq_shm.go:156		0x46f5c15		488b442410			MOVQ 0x10(SP), AX
  mq_shm.go:156		0x46f5c1a		0f57c0				XORPS X0, X0
  mq_shm.go:156		0x46f5c1d		0f11842488000000		MOVUPS X0, 0x88(SP)
  mq_shm.go:156		0x46f5c25		488d0d54fc0800			LEAQ runtime.rodata+482944(SB), CX
  mq_shm.go:156		0x46f5c2c		48898c2488000000		MOVQ CX, 0x88(SP)
  mq_shm.go:156		0x46f5c34		4889842490000000		MOVQ AX, 0x90(SP)
  mq_shm.go:156		0x46f5c3c		488d05b1091f00			LEAQ go.string.*+144140(SB), AX
  mq_shm.go:156		0x46f5c43		48890424			MOVQ AX, 0(SP)
  mq_shm.go:156		0x46f5c47		48c744240816000000		MOVQ $0x16, 0x8(SP)
  mq_shm.go:156		0x46f5c50		488d842488000000		LEAQ 0x88(SP), AX
  mq_shm.go:156		0x46f5c58		4889442410			MOVQ AX, 0x10(SP)
  mq_shm.go:156		0x46f5c5d		48c744241801000000		MOVQ $0x1, 0x18(SP)
  mq_shm.go:156		0x46f5c66		48c744242001000000		MOVQ $0x1, 0x20(SP)
  mq_shm.go:156		0x46f5c6f		e89c989eff			CALL fmt.Sprintf(SB)
  mq_shm.go:156		0x46f5c74		488b442430			MOVQ 0x30(SP), AX
  mq_shm.go:156		0x46f5c79		4889442448			MOVQ AX, 0x48(SP)
  mq_shm.go:156		0x46f5c7e		488b4c2428			MOVQ 0x28(SP), CX
  mq_shm.go:156		0x46f5c83		48894c2468			MOVQ CX, 0x68(SP)
  mq_shm.go:157		0x46f5c88		90				NOPL
  logs.go:87		0x46f5c89		488b15f0ba9600			MOVQ gw/gopkg/logs.defaultLogger(SB), DX
  logs.go:87		0x46f5c90		48891424			MOVQ DX, 0(SP)
  logs.go:87		0x46f5c94		48894c2408			MOVQ CX, 0x8(SP)
  logs.go:87		0x46f5c99		4889442410			MOVQ AX, 0x10(SP)
  logs.go:87		0x46f5c9e		0f57c0				XORPS X0, X0
  logs.go:87		0x46f5ca1		0f11442418			MOVUPS X0, 0x18(SP)
  logs.go:87		0x46f5ca6		48c744242800000000		MOVQ $0x0, 0x28(SP)
  logs.go:87		0x46f5caf		e8dc5ed7ff			CALL gw/gopkg/logs.(*Logger).Error(SB)
  errors.go:59		0x46f5cb4		488d0565640f00			LEAQ runtime.rodata+902944(SB), AX
  errors.go:59		0x46f5cbb		48890424			MOVQ AX, 0(SP)
  errors.go:59		0x46f5cbf		e87c9991ff			CALL runtime.newobject(SB)
  errors.go:59		0x46f5cc4		488b7c2408			MOVQ 0x8(SP), DI
  errors.go:59		0x46f5cc9		488b442448			MOVQ 0x48(SP), AX
  errors.go:59		0x46f5cce		48894708			MOVQ AX, 0x8(DI)
  errors.go:59		0x46f5cd2		833d37c3990000			CMPL $0x0, runtime.writeBarrier(SB)
  errors.go:59		0x46f5cd9		7546				JNE 0x46f5d21
  errors.go:59		0x46f5cdb		488b442468			MOVQ 0x68(SP), AX
  errors.go:59		0x46f5ce0		488907				MOVQ AX, 0(DI)
  mq_shm.go:158		0x46f5ce3		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:158		0x46f5cef		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:158		0x46f5cfa		488d057f682f00			LEAQ go.itab.*errors.errorString,error(SB), AX
  mq_shm.go:158		0x46f5d01		48898424f8000000		MOVQ AX, 0xf8(SP)
  mq_shm.go:158		0x46f5d09		4889bc2400010000		MOVQ DI, 0x100(SP)
  mq_shm.go:158		0x46f5d11		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:158		0x46f5d19		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:158		0x46f5d20		c3				RET
  errors.go:59		0x46f5d21		488b442468			MOVQ 0x68(SP), AX
  errors.go:59		0x46f5d26		e8b53297ff			CALL runtime.gcWriteBarrier(SB)
  errors.go:59		0x46f5d2b		ebb6				JMP 0x46f5ce3
  mq_shm.go:147		0x46f5d2d		48c78424e800000000000000	MOVQ $0x0, 0xe8(SP)
  mq_shm.go:147		0x46f5d39		c78424f000000000000000		MOVL $0x0, 0xf0(SP)
  mq_shm.go:147		0x46f5d44		0f57c0				XORPS X0, X0
  mq_shm.go:147		0x46f5d47		0f118424f8000000		MOVUPS X0, 0xf8(SP)
  mq_shm.go:147		0x46f5d4f		488bac24b8000000		MOVQ 0xb8(SP), BP
  mq_shm.go:147		0x46f5d57		4881c4c0000000			ADDQ $0xc0, SP
  mq_shm.go:147		0x46f5d5e		c3				RET
  mq_shm.go:168		0x46f5d5f		e84c3c97ff			CALL runtime.panicSliceB(SB)
  mq_shm.go:168		0x46f5d64		e8273c97ff			CALL runtime.panicSliceAcap(SB)
  mq_shm.go:168		0x46f5d69		90				NOPL
  mq_shm.go:143		0x46f5d6a		e8d11297ff			CALL runtime.morestack_noctxt(SB)
  mq_shm.go:143		0x46f5d6f		e94cfbffff			JMP gw/internal/rtcmq.(*MqShm).Read(SB)
  :-1			0x46f5d74		cc				INT $0x3
  :-1			0x46f5d75		cc				INT $0x3
  :-1			0x46f5d76		cc				INT $0x3
  :-1			0x46f5d77		cc				INT $0x3
  :-1			0x46f5d78		cc				INT $0x3
  :-1			0x46f5d79		cc				INT $0x3
  :-1			0x46f5d7a		cc				INT $0x3
  :-1			0x46f5d7b		cc				INT $0x3
  :-1			0x46f5d7c		cc				INT $0x3
  :-1			0x46f5d7d		cc				INT $0x3
  :-1			0x46f5d7e		cc				INT $0x3
  :-1			0x46f5d7f		cc				INT $0x3

It seems function copy(buf, s.content[start+packetHeaderSize:uplen+start+packetHeaderSize]) (runtime.memmove in disassembly) is after atomic memory store s.header.SetWriteOffset(woff) (XCHGL AX, 0(CX)	in disassembly) which will cause error.

This is not a complete program that I can run. There's no main or Test* function.
There are also imports, gw/pkg/logs and gw/pkg/shm, that I can't resolve, so I can't even compile it.
The memmove looks like it runs before the XCHGLs to me. The memmove is at 0x46f5a45. Subsequent to that, at  0x46f5a60 there's a jump to 0x46f59bf, which leads to the XCHGLs at 0x46f59d4 and 0x46f5a01.