<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Desenvolvimento on Cesar Gimenes</title><link>https://crg.eti.br/en/tags/desenvolvimento/</link><description>Recent content in Desenvolvimento on Cesar Gimenes</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>crg@crg.eti.br (Cesar Gimenes)</managingEditor><webMaster>crg@crg.eti.br (Cesar Gimenes)</webMaster><lastBuildDate>Sat, 08 Feb 2025 13:38:17 -0300</lastBuildDate><atom:link href="https://crg.eti.br/en/tags/desenvolvimento/index.xml" rel="self" type="application/rss+xml"/><item><title>Running Remote Commands Interactively with SSH</title><link>https://crg.eti.br/en/post/executando-comandos-remotos-de-forma-interativa-com-ssh/</link><pubDate>Sat, 08 Feb 2025 13:38:17 -0300</pubDate><author>crg@crg.eti.br (Cesar Gimenes)</author><guid>https://crg.eti.br/en/post/executando-comandos-remotos-de-forma-interativa-com-ssh/</guid><description>&lt;p>I often need to run a command on a remote server without starting a full interactive session. I want the program to keep all the characteristics of a local process while running on the remote server.&lt;/p>
&lt;p>At first, I just used the &lt;code>ssh&lt;/code> command, specifying the server and the command to run:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>ssh server command
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This method doesn&amp;rsquo;t work well for programs that require a pseudo terminal, like &lt;em>Neovim&lt;/em>. To fix that, I tried the &lt;code>-t&lt;/code> option to force pseudo terminal allocation. With it, programs like &lt;code>ls&lt;/code> display colors, but the user environment isn&amp;rsquo;t loaded. In that case, I need to pass the &lt;code>--color&lt;/code> option to &lt;code>ls&lt;/code>. Even so, programs like &lt;em>Neovim&lt;/em> fail because the &lt;em>shell&lt;/em> doesn&amp;rsquo;t behave as interactive and ANSI codes aren&amp;rsquo;t processed correctly.&lt;/p></description></item><item><title>Traceback in Go: How to Explore the Call Stack</title><link>https://crg.eti.br/en/post/tracebacks-em-go/</link><pubDate>Thu, 06 Feb 2025 02:12:46 -0300</pubDate><author>crg@crg.eti.br (Cesar Gimenes)</author><guid>https://crg.eti.br/en/post/tracebacks-em-go/</guid><description>&lt;p>Many programming languages provide some kind of &amp;ldquo;stack trace&amp;rdquo; or &amp;ldquo;backtrace&amp;rdquo;. Python has the &lt;code>traceback&lt;/code> module, C on Linux offers the &lt;code>backtrace()&lt;/code> function in &lt;code>execinfo.h&lt;/code> (not part of the C standard), and Java includes &lt;code>Thread.dumpStack()&lt;/code> or &lt;code>e.printStackTrace()&lt;/code> for exceptions.&lt;/p>
&lt;h2 id="stack-trace-in-go">Stack Trace in Go&lt;/h2>
&lt;p>Go provides the &lt;code>runtime.Caller&lt;/code> function to get information about the call stack. The following example prints the file, line, and function that called &lt;code>info()&lt;/code>. Note that the argument &lt;code>1&lt;/code> passed to &lt;code>runtime.Caller&lt;/code> means we want information about the function that called &lt;code>info()&lt;/code>:&lt;/p></description></item></channel></rss>