我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Go中的“ | =”运算符是什么意思?

I've found this operator |= and I'm wondering what it means

func getPageInfoMode(r *http.Request) (mode PageInfoMode) {
    for _, k := range strings.Split(r.FormValue("m"), ",") {
        if m, found := modeNames[strings.TrimSpace(k)]; found {
            mode |= m
        }
    }
    return
}

Is an inplace bitwise OR operator https://golang.org/ref/spec#Operators.

There are many others:

+    &     +=    &=     &&    ==    !=        
-    |     -=    |=     ||    <     <=        
*    ^     *=    ^=     <-    >     >=        
/    <<    /=    <<=    ++    =     :=        
%    >>    %=    >>=    --    !            
&^   &^=

近期文章

  • Go / Revel:使用/导入修改版的外部包?
  • 转到:如何获取任何go文件的自动完成功能
  • 去大猩猩多路复用器不按预期路线
  • 使用gdb调试-log.Println停止gdb
  • 去安装不会创建bin文件
  • 固定大小的数组包含多个特定类型?
  • 使用mongodb的Golang数据库连接池
  • 用接口返回类型定义接口方法
  • 使用(xpath)条件解组XML
  • go-通过http中的zip文件提供内容
  • 去包装httprouter有记录器?
  • 前往App Engine oauth2请求
  • 如何记录每个请求/上下文-Golang
  • 遍历XML
  • 去https客户端泄漏
  • 如何在Martini中设置默认静态页面?
  • 保存时,LiteIDE删除导入
  • 在goroutine中发送电子邮件
  • 在openshift中部署beego应用程序
  • 如何在Openshift上部署Revel Web应用程序?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华