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

如何用回车符打印字符串

I have a string which ends with a carriage return:

        str := "my data"

If I try to print that string, using:

        fmt.Println(str)

all it shows is an empty line. How do I make it output full string, like "my data", without trimming the last character (carriage return)?

It was caused by Emacs terminal, which discarded data printed before carriage return.

Using gnome-terminal fixed it. Thanks for your help @peter

近期文章

  • 如何在Golang中将vars传递给chi路由器
  • 为多个库版本构建Go绑定?
  • interface {}转换为unsafe.Pointer问题
  • 在Go中创建具有约束的自定义类型
  • gccgo不知道-fgo-relative-import-path
  • 获取File()后无法关闭golang tcp套接字
  • GO:使用html / template提供模板时出错
  • 这很好构建。为什么此代码不执行?
  • Golang:从maildir解析多部分电子邮件
  • 如何使用docker-compose运行golang-migrate?
  • 执行:读取文件中特定范围的行
  • 如何使用正则表达式提取子字符串?
  • CGO将Xlib XEvent结构转换为字节数组?
  • 如何使用golang从Firebase删除密钥?
  • 解组异构结构的JSON数组
  • 无法部署Go语言编写的Lambda函数
  • 缓冲区为空后,关闭“工作者”执行例程
  • 使用Go模块组织程序包中的本地代码
  • 转:输入的指针与接口不兼容
  • 如何在Go中从json字符串获取键值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华