D
D
Denis Stok2019-11-02 10:43:42
css
Denis Stok, 2019-11-02 10:43:42

And again my hated tar with an error?

Why does panic occur when writing a header?

failed to add /root/Projects to tar: archive/tar: missed writing 443 bytes

in the following code
// ...
walker := func(file string, finfo osFileInfo, err error) error {
  // ...
  if err := tw.WriteHeader(hdr); err != nil {
    return err
  }
  tw.Flush()
  // ...
}

The full code can be taken from here
https://github.com/vladimirvivien/go-tar/blob/mast...

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
dicem, 2018-09-20
@dicem

Bootstrap 3.*:

<div class="container">
  <div class="row">
    <div class="col-lg-3"></div>
    <div class="col-lg-3"></div>
    <div class="col-lg-3"></div>
    <div class="col-lg-3"></div>
  </div>
</div>

Well, for adaptability, use the classes col-lg-* col-md-* col-sm-* col-xs-*

V
Vladimir Proskurin, 2018-09-20
@Vlad_IT

No need for float. You do it through flex, and set the property
justify-content: space-between to the block,
then the blocks will be evenly distributed over the entire width. If you want exactly 25% width, then set flex-basis: 25% to each block.

N
NaN, 2018-09-20
@KornevaViktoria

Like this, you
leave the Logo on the left side.
The rest is placed in a common div and aligned to the right, setting the appropriate class.
You make a wrapper for each element, to which you set an indent on the left, except for the last element.
For naming classes, use BEM, it will be more clear what belongs to what

D
Dyzz24, 2018-09-21
@Dyzz24

Parent display: flex
Further, if you just want to scatter it around the container without problems, justify-content: space-between

P
Pavel, 2018-09-20
@PavelMonro

What exactly are you talking about?
There are 4 blocks, so something like this is being done:

<style>
.wrap {width:100%;margin: auto;}
.wrap .col {width:25%;float:left;}
</style>
<div class="wrap">
<div class="col">1</div>
<div class="col">2</div>
<div class="col">3</div>
<div class="col">4</div>
</div>

U
uvelichitel, 2019-11-05
@stokdenis

Not much code, but at first glance it's not a panic on write header, but an error on try tw.Flush(), which you haven't checked. After recording header, you need to fill in the actual data and only then do it . You promised to fill in the data and did not fill it. Seems like it should be something liketw.Write(data []byte)tw.Flush()header

if err := tw.WriteHeader(hdr); err != nil {
    return err
}
if n, err := tw.Write(content); err != nil { //вот это не видно как вы сделали
    return err
}
if tw.Flush(); err != nil{ //и нужно проверять все ошибки
    return err
}

F
falconandy, 2019-11-02
@falconandy

If unimportant, try https://github.com/mholt/archiver . Or see how it's done.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question