Skip to content

Commit

Permalink
add new git post
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroidentidad committed Jun 1, 2024
1 parent 402178e commit 1037cb3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
Binary file added content/posts/git-find-go-deps/images/git-go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions content/posts/git-find-go-deps/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "Git y Go: encontrar versiones disponibles de paquetes externos"
date: 2024-06-01T13:26:55-06:00
draft: false
author: zeroidentidad
year: "2024"
month: "2024/06"
categories:
- Tutorial
- Versiones
tags:
- software
- golang
keywords:
- git
- github
disableComments: false
---

{{<postimage "images/git-go.png" "git pkgs">}}

Digamos que se quiere saber qué versiones de un paquete de terceros están disponibles. En relación a la posibilidad de actualizar una dependencia principal o degradar a una version anterior por incompatilidad de cambios.

<!--more-->

Gracias al ***go.mod*** que lista las dependencias y versiones en uso sirve para comparar con un comando de git de listado remoto de las versiones de los paquetes que se necesiten revisar, solo que colocando la URI para que sea valida para git. Esto es usando ***git ls-remote -t*** para enumerar todas las versiones, o ***git ls-remote -h*** para enumerar todas las ramas del repositorio. Alternativamente, para confirmar fuera de la terminal se puede ir al sitio web de GitHub, GitLab, etc. y navegar hasta poder ver las etiquetas o ramas.

Esto no es exactamente algo puramente de Go, pero es un consejo útil para determinar las versiones de paquetes disponibles aprovechando **git** sin reinventar la rueda.

**Ejemplo:**

Suponiendo que se necesita conocer las versiones y ramas disponibles si se desea utilizar versiones que no sean las más recientes del paquete. Entonces con **ls-remote** como se meciono se pueden ver las etiquetas y los encabezados, respectivamente. En Git, las etiquetas se utilizan a menudo para marcar lanzamientos o versiones. Las cabeceras son las puntas de las ramas, por lo que las cabeceras representan las ramas disponibles del repositorio.

Por ejemplo, ejecutando esto desde la línea de comando para enumerar todas las versiones en **gorilla/mux**:

```sh
$ git ls-remote -t https://github.com/gorilla/mux.git
```

Mostraria algo como:

![redis](./images/screenshot.png)

Si se está utilizando GitHub o GitLab o algún otro SaaS que proporcione un servicio de repositorio de código, git también puede ir al sitio y encontrar las etiquetas o ramas a mostrar.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap";@media only screen and (min-width:768px){.project-container{display:flex}.project-container .project-list{width:20%}.project-container .project{flex:1}}#output li{list-style:none}.post-list{display:flex;flex-flow:row wrap;justify-content:space-evenly}.post-list .box-post{display:flex;flex-direction:column;flex-basis:calc(33% - 2.5rem);justify-content:flex-end;margin:.4rem;padding:.5rem;align-items:stretch}.post-list .box-post .title{text-decoration:none;flex:1}.post-list .box-post .title h3{color:#0086b3;flex-basis:20%;font-size:1.25em}.post-list .box-post .date{font-size:.9em;color:#818181}.post-list .box-post .summary-container{max-height:310px;overflow:hidden}.post-list .box-post .summary-container figure{max-width:300px;height:150px;margin-left:auto;margin-right:auto}.post-list .box-post .summary-container figure img{width:100%;height:100%;object-fit:cover}.post-list .box-post .summary-container figure figcaption{display:none}.post-list .box-post .summary-container p{font-size:.85em;color:#616161}.post{max-width:768px;margin:auto}.post>*{margin:2rem 0}.post header>*{margin:2rem 0}.post header h2{font-size:2.5em}.post header .tags{display:flex;flex-direction:row;flex-wrap:wrap}.post header .tags .tag{margin:.25rem;padding:.5rem;border-radius:5px;font-weight:700;font-size:.9em;background-color:#0086b3;color:#fff}.post header .meta{display:flex;flex-direction:column;font-size:.9em}.post header .meta label{padding:.5rem 0}.post header a.tag,.post .body a.tag{background-color:#ddd;color:#333;display:inline-block;padding:.1em;font-size:.9em;text-decoration:none}.post header figure,.post .body figure{display:flex;flex-direction:column;justify-content:center;align-items:center}.post header figure img,.post .body figure img{width:auto;height:auto;max-width:768px;max-height:400px;margin:auto;padding:1rem}.post header figure figcaption,.post .body figure figcaption{font-size:.8em;color:#666}.post .highlight pre{padding:1rem;border-radius:5px;overflow:auto}@media(max-width:768px){.post-list{flex-direction:column}.post figure img{max-width:100%}}.home .home-head{text-align:center;margin:1rem 0;padding:1rem 0}.home .home-head h1{margin:1rem 0;font-size:3.5em}.home .home-head label{font-size:.8em;color:#414141}.home .animation-gopher{margin:auto;max-width:150px;width:80%}.home .content{padding:1rem 0;display:flex;flex-direction:row;justify-content:center;flex-wrap:wrap}.home .content .box-section{flex-basis:calc(30% - 4rem);margin:1rem;text-decoration:none;display:flex;flex-direction:column;text-align:center;padding:1rem;color:#7c1ad2}.home .content .box-section:hover{background-color:#0086b3}.home .content .box-section:hover b{color:#fff}.home .content .box-section b{color:#313131}@media(max-width:768px){.home .content .box-section{flex-basis:calc(100% - 4rem)}}footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:2rem}html,body,.container{width:100%;height:100%;margin:0;font-family:work sans,san-serif}.app-width{width:calc(100% - calc(10px * 2))!important;padding-left:10px!important;padding-right:10px!important}@media(min-width:1020px){.app-width{width:1000px!important;padding-left:calc(50% - calc(1000px/2))!important;padding-right:calc(50% - calc(1000px/2))!important}.app-width p>img{height:350px;display:block;margin:auto}}.box{border:1px solid #ddd;background-color:#fff;border-radius:.5rem}.box:hover{border:1px solid transparent;box-shadow:1px 1px 5px #999}a{text-decoration:none;color:#0013ff}a:hover{text-decoration:underline;cursor:pointer}.page-header{display:flex;flex-direction:row;justify-content:center;align-items:center;height:75px;border-bottom:1px solid #ddd}.page-header .header-left{text-align:left}.page-header .header-center{text-align:center;flex:1}.page-header .header-right{text-align:right}.page-header .button-search{text-decoration:none}.page-header:hover{border-bottom:1px solid #ccc;box-shadow:1px 1px 3px #ccc}nav a{text-decoration:none!important;font-weight:700;color:#313131;padding:.5rem;font-size:.9em}nav a:hover{color:#0086b3}.oss{display:flex;flex-wrap:wrap;justify-content:space-between}.oss article{border:1px solid #ddd;box-shadow:3px 3px 3px #ddd;margin:.5%;padding:.5%;width:30%;border-radius:4px;text-align:center}.colabs{display:flex;flex-wrap:wrap;justify-content:space-between;text-align:center}.colabs article{border:1px solid #ddd;margin:.5%;padding:.5%;width:20%;border-radius:10px;box-shadow:1px 1px 1px #c2c2c2;background-color:#fcfcfc}.colabs img{width:55px;height:55px;border-radius:5px;padding-bottom:8%}.colabs a{text-decoration:none;color:#333;font-size:16px}.colabs a:hover{text-decoration:underline;cursor:pointer}.pagination{display:flex;justify-content:space-between;list-style:none;margin:1em auto;padding:0}@media only screen and (min-width:768px){.pagination{width:30%}}.pagination>.page-item{border:1px solid #ddd;flex:1;text-align:center;width:5em}.pagination .page-link{display:block;color:#000;text-decoration:none}.pagination>.page-item.active{background-color:#333}.pagination>.page-item.active>.page-link{color:#fff}.pagination>.page-item.disabled>.page-link{color:#ddd}
@import "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap";@media only screen and (min-width:768px){.project-container{display:flex}.project-container .project-list{width:20%}.project-container .project{flex:1}}#output li{list-style:none}.post-list{display:flex;flex-flow:row wrap;justify-content:space-evenly}.post-list .box-post{display:initial;flex-basis:calc(33% - 2.5rem);margin:.4rem;padding:.5rem}.post-list .box-post .title{text-decoration:none;flex:1}.post-list .box-post .title h3{color:#0086b3;flex-basis:20%;font-size:1.25em}.post-list .box-post .date{font-size:.9em;color:#818181}.post-list .box-post .summary-container{max-height:310px;overflow:hidden}.post-list .box-post .summary-container figure{max-width:300px;height:150px;margin-left:auto;margin-right:auto}.post-list .box-post .summary-container figure img{width:100%;height:100%;object-fit:cover}.post-list .box-post .summary-container figure figcaption{display:none}.post-list .box-post .summary-container p{font-size:.85em;color:#616161}.post{max-width:768px;margin:auto}.post>*{margin:2rem 0}.post header>*{margin:2rem 0}.post header h2{font-size:2.5em}.post header .tags{display:flex;flex-direction:row;flex-wrap:wrap}.post header .tags .tag{margin:.25rem;padding:.5rem;border-radius:5px;font-weight:700;font-size:.9em;background-color:#0086b3;color:#fff}.post header .meta{display:flex;flex-direction:column;font-size:.9em}.post header .meta label{padding:.5rem 0}.post header a.tag,.post .body a.tag{background-color:#ddd;color:#333;display:inline-block;padding:.1em;font-size:.9em;text-decoration:none}.post header figure,.post .body figure{display:flex;flex-direction:column;justify-content:center;align-items:center}.post header figure img,.post .body figure img{width:auto;height:auto;max-height:400px;margin:auto}.post header figure figcaption,.post .body figure figcaption{font-size:.8em;color:#666}.post .highlight pre{padding:1rem;border-radius:5px;overflow:auto}@media(max-width:768px){.post-list{flex-direction:column}.post figure img{max-width:100vw}}.home .home-head{text-align:center;margin:1rem 0;padding:1rem 0}.home .home-head h1{margin:1rem 0;font-size:3.5em}.home .home-head label{font-size:.8em;color:#414141}.home .animation-gopher{margin:auto;max-width:150px;width:80%}.home .content{padding:1rem 0;display:flex;flex-direction:row;justify-content:center;flex-wrap:wrap}.home .content .box-section{flex-basis:calc(30% - 4rem);margin:1rem;text-decoration:none;display:flex;flex-direction:column;text-align:center;padding:1rem;color:#7c1ad2}.home .content .box-section:hover{background-color:#8cc5e7}.home .content .box-section:hover b{color:#fff}.home .content .box-section b{color:#313131}@media(max-width:768px){.home .content .box-section{flex-basis:calc(100% - 4rem)}}p img{max-width:100%;height:auto;display:block;margin-left:auto;margin-right:auto}.image-project{max-width:100%;height:auto;display:block;margin:0 auto}footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:2rem}html,body,.container{width:100%;height:100%;margin:0;font-family:work sans,san-serif}.app-width{width:calc(100% - calc(10px * 2))!important;padding-left:10px!important;padding-right:10px!important}@media(min-width:1020px){.app-width{width:1000px!important;padding-left:calc(50% - calc(1000px/2))!important;padding-right:calc(50% - calc(1000px/2))!important}.app-width p>img{height:350px;display:block;margin:auto}}.box{border:1px solid #ddd;background-color:#fff;border-radius:.5rem}.box:hover{border:1px solid transparent;box-shadow:1px 1px 5px #999}a{text-decoration:none;color:#0013ff}a:hover{text-decoration:underline;cursor:pointer}.page-header{display:flex;flex-direction:row;justify-content:center;align-items:center;height:75px;border-bottom:1px solid #ddd}.page-header .header-left{text-align:left}.page-header .header-center{text-align:center;flex:1}.page-header .header-right{text-align:right}.page-header .button-search{text-decoration:none}.page-header:hover{border-bottom:1px solid #ccc;box-shadow:1px 1px 3px #ccc}nav a{text-decoration:none!important;font-weight:700;color:#313131;padding:.5rem;font-size:.9em}nav a:hover{color:#0086b3}.oss{display:flex;flex-wrap:wrap;justify-content:space-between}.oss article{border:1px solid #ddd;box-shadow:3px 3px 3px #ddd;margin:.5%;padding:.5%;width:30%;border-radius:4px;text-align:center}.colabs{display:flex;flex-wrap:wrap;justify-content:space-between;text-align:center}.colabs article{border:1px solid #ddd;margin:.5%;padding:.5%;width:20%;border-radius:10px;box-shadow:1px 1px 1px #c2c2c2;background-color:#fcfcfc}.colabs img{width:55px;height:55px;border-radius:5px;padding-bottom:8%}.colabs a{text-decoration:none;color:#333;font-size:16px}.colabs a:hover{text-decoration:underline;cursor:pointer}@media only screen and (max-width:768px){.colabs article{width:45%;margin:1.5%}.colabs img{width:90px;height:90px}}@media only screen and (max-width:480px){.colabs article{width:100%;margin:1.5%}.colabs img{width:90px;height:90px}}.pagination{display:flex;justify-content:space-between;list-style:none;margin:1em auto;padding:0}@media only screen and (min-width:768px){.pagination{width:30%}}.pagination>.page-item{border:1px solid #ddd;flex:1;text-align:center;width:5em}.pagination .page-link{display:block;color:#000;text-decoration:none}.pagination>.page-item.active{background-color:#333}.pagination>.page-item.active>.page-link{color:#fff}.pagination>.page-item.disabled>.page-link{color:#ddd}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"css/style.min.9ad607666a074b87e1947db35c92238362e046ff8e838bfef9f3692dca5c7856.css","MediaType":"text/css","Data":{"Integrity":"sha256-mtYHZmoHS4fhlH2zXJIjg2LgRv+Og4v++fNpLcpceFY="}}
{"Target":"css/style.min.d014c13d6e77ff98797c23bcfd3bdeaf0cb513a7bd8e559468cc442576c24a0e.css","MediaType":"text/css","Data":{"Integrity":"sha256-0BTBPW53/5h5fCO8/Tverwy1E6e9jlWUaMxEJXbCSg4="}}

0 comments on commit 1037cb3

Please sign in to comment.